Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 40 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
40
Dung lượng
842 KB
Nội dung
Week 3 WindowsControls Contents MenuStrip and ContextMenuStrip control TreeView (p.110) Advanced topics (p.521) Slide 2 Create MenuStrip at run-time Add a menu to MenuStrip control at run-time MenuStrip.Items.Add method Example: MenuStrip.Items.Add("File"); MenuStrip.Items.Add("View"); Add a menu item to other menu item at run-time ToolStripMenuItem.DropDownItems.Add method Example: ToolStripItem mnuOpen; mnuOpen = fileMenuItem.DropDownItems.Add("Open"); mnuOpen.Click += new EventHandler(mnuOpen_Click); Slide 3 ContextMenuStrip control (p.173) ContextMenuStrip similar to the MenuStrip control The main difference between the ContextMenuStrip and the MenuStrip ContextMenuStrip control does not have a top-level menu Not visible at run time unless invoked by right-clicking the control that it is associated with Slide 4 ContextMenuStrip control (cont.) Associating a ContextMenuStrip property with a control Using ContextMenuStrip property of a control or Write in Mouse_Up event handler ContextMenuStrip1.Show(Control, X, Y) Demo: Module 4 – Exercise 3 (modified) Slide 5 TreeView control (p.110) The TreeView control allows you to display a list of objects in a hierarchical manner Node Root Parent Node Child Node Level of nodes TreeNode object Slide 11 TreeView properties Nodes: gets the collection of child nodes belong to TreeView FullRowSelect: True/False HideSelection: True/False ImageList LabelEdit: True/False ShowLines: True/False SelectedNode: get or set the selected node Slide 12 Add icons for TreeNode Using ImageList like ListView For each TreeNode, set: ImageIndex SelectedImageIndex Exercise: Module 5 - Ex 1,2 Slide 15 TreeNode properties Text ImageIndex SelectedImageIndex IsSelected Level Parent Nodes: gets the collection of child nodes belong to a TreeNode Slide 16 TreeNode methods Methods Description Expand() Expands a node Collapse() Collapses a node ExpandAll() Expands all the children of a node CollapseAll() Collapses all the children of a node GetNodeCount() Return the number of child node Slide 17 [...]... for each TreeNode Slide 29 Advanced topics in Windows Forms MDI application (p.543) Drag-Drop (p.523) Self-study Using user assistance controls and components Implementing Globalization and Localization for a Windows Forms application Deploying applications with ClickOnce Creating setup projects for deployment Slide 32 Using user assistance controls and components PropertyGrid... Advanced topics in Windows Forms MDI application (p.543) Drag-Drop (p.523) Self-study Using user assistance controls and components Persisting application settings between sessions Implementing Globalization and Localization for a Windows Forms application Deploying applications with ClickOnce Creating setup projects for deployment Slide 44 Using user assistance controls and components... ErrorProvider HelpProvider SoundPlayer Timer HScrollBar VScrollBar Slide 33 MDI application Multiple Document Interface (MDI) Windows Single Document Interface (SDI) IsMdiContainer = False Multiple Document Interface (MDI) IsMdiContainer = True Slide 34 Redisplaying child windows Find form If not existing Show If existing Activate private void HienForm( Form f ) { bool thay = false; foreach (Form