文档详情

c#.net程式设计.ppt

发布:2017-02-11约1.34万字共82页下载文档
文本预览下载声明
C#.NET 程式設計 第十一章 Windows Forms 控制項 11-1 Windows Forms 簡介 “Windows Forms” 是全新的視窗應用程式介面 “Web Forms” 與 “Web Services” 組成了全新的網際網路應用程式介面,.NET Framework 將之統稱為 “ASP.NET” 查看 System.Windows.Forms 命名空間提供的成員 11-2 設計階段的表單 11-2-1 建立表單 啟動 Visual Studio.NET。 點取 [起始頁] 的 [新增專案] 按鈕。 選擇 [Visual C# 專案] 類型及 [Windows 應用程式] 範本,並輸入專案的名稱,然後按 [確定]。 11-2-2 設定表單的格線大小 格線可以幫助我們對齊控制項,如果要設定格線的大小或顯示與否,可以選取 [工具] \ [選項],然後點取 [Windows Forms 設計工具],再依照下圖操作: 11-2-3 設定起始表單 在方案總管內的專案名稱按一下滑鼠右鍵,然後從快顯功能表中選取 [屬性],再於如下對話方塊的 [啟始物件] 欄位選取該表單: 11-2-4 設定表單的屬性 只要選取表單,屬性視窗就會列出被選取之表單的常用屬性供您查看或修改 表單的外觀屬性 BackColor BackgroundImage Cursor ForeColor RightToLeft Text Font FormBorderStyle 表單的配置方式:「單一文件介面」(SDI) 、「多重文件介面」(MDI) 、「總管樣式介面」(Explorer-Style Interface) 表單的配置屬性 AutoScale AutoScroll AutoScrollMargin AutoScrollMinSize DockPadding Location MaximumSize MinimumSize Size StartPosition WindowState 11-3 執行階段的表單 執行階段的表單就像所有物件,會有建立與終止的時候。 相關的控制項事件: 11-4 文字編輯控制項 11-4-1 TextBox (文字方塊) 文字方塊的外觀屬性 BackColor BorderStyle Cursor Font ForeColor Lines RightToLeft ScrollBars Text TextAlign 文字方塊的行為屬性 AcceptsReturn AcceptsTab AllowDrop AutoSize CharacterCasting ContextMenu Enabled HideSelection ImeMode MaxLength Multiline PasswordChar ReadOnly TabIndex TabStop Visible WordWrap 11-4-2 RichTextBox RichTextBox 的屬性 AutoWordSelection BulletIndent DetectUrls ShowSelectionMargin -ZoomFactor? RichTextBox 的格式化屬性 SelectedText SelectionAlignment SelectionBullet SelectionCharOffset SelectionColor SelectionFont SelectionIndent SelectionHangingIndent SelectionRightIndent SelectionStart SelectionLength SelectionProtected SelectionType SelectionTabs 11-5 命令控制項 11-5-1 Button (按鈕) Button 的外觀屬性 BackColor BackgroundImage Cursor FlatStyle Font ForeColor Image ImageAlign ImageIndex ImageList RightToLeft Text TextAlign Button 的行為屬性 AllowDrop ContextMenu DialogResult Enabled TabIndex TabStop Visible Name? 11-5-2 NotifyIcon (告知圖示) 比較重要的屬性有 Icon 、Visible 、Text 11-5-3 ToolBar (工具列) ToolBar 的外觀屬性 BorderStyle ButtonSize Divider DropDownArrows Font Te
显示全部
相似文档