Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 6. Working with Forms > The Bottom Line

6.5. The Bottom Line


Visual form design

Forms expose a lot of trivial properties for setting their appearance. In addition, they expose a few properties that simplify the task of designing forms that can be resized at runtime. The Anchor property causes a control to be anchored to one or more edges of the form to which it belongs. The Dock property allows you to place on the form controls that are docked to one of its edges. To create forms with multiple panes that the user can resize at runtime, use the SplitContainer control. If you just can't fit all the controls in a reasonably sized form, use the AutoScroll properties to create a scrollable form.


Master It

You've been asked to design a form with three distinct sections. You should also allow users to resize each section. How will you design this form?


Design applications with multiple forms.

Typical applications are made up of multiple forms: the main form and one or more auxiliary forms. To show an auxiliary form from within the main form's code, call the auxiliary form's Show method, or the ShowDialog method if you want to display the auxiliary form modally (as a dialog box).


Master It

How will you set the values of selected controls in a dialog box, display them, and then read the values selected by the user from the dialog box?


Design dynamic forms.

You can create dynamic forms by populating them with controls at runtime through the form's Controls collection. First, create instances of the appropriate controls by declaring variables of the corresponding type. Then set the properties of each of these variables that represent controls. Finally, place the control on the form by adding the corresponding variable to the form's Controls collection.


Master It

How will you add a TextBox control to your form at runtime and assign a handler to the control's TextChanged event?


Design menus.

Both form menus and context menus are implemented through the MenuStrip control. The items that make up the menu are ToolStripMenuItem objects. The ToolStripMenuItem objects give you absolute control over the structure and appearance of the menus of your application.


Master It

What are the two basic events fired by the ToolStripMenuItem object?


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial