Docsity

Understanding SDI and MDI in Windows Apps, Slides of C programming

Partial preview of the text

Download Understanding SDI and MDI in Windows Apps and more Slides C programming in PDF only on Docsity!

Additional Controls

16_additional_controls.ppt

Overview of Topics

• Single Document Interface (SDI)

• Multiple Document Interface (MDI)

• ToolStrip Control

• Calendar Controls

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.

MDI Example

Windows Menu Option

  • Allows the user to arrange multiple Child forms.
  • Allows the user to switch between 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.

LayoutMdi Method

  • Use the LayoutMdi method 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); }

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.

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();

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.

Summary

• Single Document Interface (SDI)

• Multiple Document Interface (MDI)

• Toolbar Control

• Calendar Controls