INITIATING ACTION

Every kind of control responds to events, so every control can initiate an action. In practice, however, users expect only certain kinds of controls to perform actions. For example, they generally don’t expect the application to launch into a time-consuming calculation when the mouse moves over a label.

The following table summarizes controls that normally initiate action.

CONTROL PURPOSE
Button1 Raises a Click event that the program can catch to perform an action. (See example program UseButtonRepeatButton, available for download on the book’s website.)
ContextMenu Displays a context menu for other controls. Normally the ContextMenu contains MenuItem controls. (See example program UseMenuContextMenu, available for download on the book’s website.)
Menu Displays a menu for the form. Normally, the Menu contains MenuItem controls representing the top-level menus. Those items contain other MenuItem controls representing commands. (See example program UseMenuContextMenu, available for download on the book’s website.)
MenuItem Contains an item in a ContextMenu or Menu.
PrintDialog Displays a standard Windows print dialog. You shouldn’t place a PrintDialog on a window. Instead use code to build and display the PrintDialog. (See example program UsePrintDialog, available for download on the book’s website.)
RepeatButton1 Acts as a Button that raises its Click event repeatedly when it is pressed and held down. (See example program UseButtonRepeatButton, available for download on the book’s website.)
ToolBar Contains items. Normally, the control sits across the top of the form and contains command items such as buttons and combo boxes. (See example program UseToolBar, available for download on the book’s website.)
ToolBarTray Contains ToolBars and allows the user to drag them into new positions. (See example program UseToolBar, available for download on the book’s website.)

1This control can hold only a single child.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.98.239