|
|
Menus, Sub Procedures, and Functions
Menus (Pages 198 -205)Describes how to use the Visual Studio Menu Designer to design menus. Menu properties can be edited visually using the Menu Designer. This makes laying out menus very easy. Remember to name all menu items. You can switch between Text mode and Name mode by right clicking on any menu item and selecting "Edit Names" from the resulting context menu. Menu Item text is selectable using key combinations. The selected key is indicated by preceding a character in the menu item text with an ampersand "&" character. Use the same conventions used by Microsoft for naming common menu items (such as "File" or "Exit"). Use the same conventions for choosing the selectable character (e.g. Alt-E for "Edit"). Remember to group similar items within a drop down menu by using separator bars (page 201). Menu items, with regard to events, behave much as do buttons. In order to add code for a click event to a menu item, double left click on the menu item in the Menu Designer. The code editor will display the click event code for the menu item (creating a code stub if necessary).
Common Dialog Boxes (Pages 205 -208)In order to make your life easier and to assist in providing a common look and feel across windows applications, Microsoft provides various standard menus for common tasks such as browsing for a file, changing colors and fonts and so on. You should use these common dialog boxes supplied by Microsoft rather than writing your own, whenever possible. Users of your program will feel more comfortable is such dialogs work just like others they are familiar with. Common dialog boxes are available as tools on the VB tool bar. To add one to your dialog box, double click on the common dialog box's icon on the tool bar. It will be added to the visual designer below your dialog box's edit screen. You display a common dialog box using the "ShowDialog" method of the dialog box object (see page 206). Example:
Creating Context Menus (Pages 208 - 211)Context menus are menus which pop up when you right click on a menu. They provide a list of common tasks that make sense in the context of the window upon which you right clicked. Adding a context window to a dialog box is similar to adding a menu bar. The primary difference is that a context menu is a single menu and a menu bar is a bar of drop down menus. Therefore, when editing a context menu, there is only one menu to edit. To add a context menu to your dialog, select the dialog and then double left click on the context menu icon in the tool bar of the visual designer.
Writing General Procedures (Pages 211 - 222)
Your Hands-On Programming Example
|