1 / 14

CIS162AD - C#

CIS162AD - C#. Additional Controls 16_additional_controls.ppt. Overview of Topics. Single Document Interface (SDI) Multiple Document Interface (MDI) ToolStrip Control Calendar Controls. Single Document Interface (SDI).

jenn
Download Presentation

CIS162AD - C#

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CIS162AD - C# Additional Controls 16_additional_controls.ppt

  2. Overview of Topics • Single Document Interface (SDI) • Multiple Document Interface (MDI) • ToolStrip Control • Calendar Controls

  3. Single Document Interface (SDI) • Each form is in a separate window that acts independently from the other forms in the application. • This what we have created so far. • Even when we display another form (ShowDialog), the 2nd form is displayed in its own window, for example the About form. It is independent of the startup or main form.

  4. Multiple Document Interface (MDI) • Multiple forms are displayed within the same window. • Parent form (main window) "contains" other forms. • Many Child forms (document windows) can be "contained within" Parent window. • Parent and Child may share menus, toolbars, etc. • Should add a Window menu option that allows users: • To switch between opened documents. • Display documents as Tile Vertically, Tile Horizontally or Cascade.

  5. MDI Example

  6. MDI Implementation • At design time designate a form as Parent. • IsMdiContainer property = True • At run time designate Child forms. • Create an instance of the child form, but before displaying the child form set the child's MdiParent property to the current form using the this reference.private void tbbChild1_Click(object sender, EventArgs e) { ChildForm1 frmChild1 = new ChildForm1(); frmChild1.MdiParent = this; frmChild1.Show(); }

  7. Windows Menu Option • Allows the user to arrangemultiple Child forms. • Allows the user to switchbetween documents. • To list opened Child documents • Create a Windows menu item (mnuWindows) • On the menuStrip, set MdiWindowListItem property to the Windows menu item name (mnuWindows). • This will list the child documents automatically.

  8. Use the LayoutMdimethod to set the type of layout: this.LayoutMdi(MdiLayout.TileHorizontal); this.LayoutMdi(MdiLayout.TileVertical); this.LayoutMdi(MdiLayout.Cascade);private void mnuWindowTileHortzonal_Click(object sender, EventArgs e){ this.LayoutMdi(MdiLayout.TileHorizontal);} LayoutMdi Method

  9. ToolStrip Control

  10. ToolStrip Control • Place the ToolStrip control on the form. • Click on the Add ToolStripButton to get a dropdown list of options. • Select the first one, Button to add a button to the toolStrip. • Click on a button to select it, and then set the properties for it, including the Name (tbbChild1), Image, and Text.Text becomes the tool tip.

  11. Coding for ToolStrip Buttons • Each button on the toolStrip has its own ButtonClick event. • Double click on the button to create the default method and enter the required code.private void tbbChild1_Click(object sender, EventArgs e) { ChildForm1 frmChild1 = new ChildForm1(); frmChild1.MdiParent = this; frmChild1.Show(); }

  12. Calendar Control Options DateTimePicker MonthCalendar

  13. Calendar Control • Provides the ability to display calendars on a form. • DateTimePicker • Displays only day and date unless user drops down the calendar. • Value property contains date. • MonthCalendar • Displays entire month as a calendar. • Stores a date range, so values are stored in SelectionRange.Start and SelectionRange.End • Event triggered when value or date is changed.

  14. Summary • Single Document Interface (SDI) • Multiple Document Interface (MDI) • Toolbar Control • Calendar Controls

More Related