Customizing Toolbars

If the standard toolbars that ship with Visual Studio don’t meet your needs, you can create custom toolbars that do. Select the Tool menu’s Customize item or right-click a toolbar in the IDE and select Customize to launch the Customize dialog box shown in Figure 2.19.

Image

FIGURE 2.19 The Customize dialog box allows you to select and customize menus and toolbars in the IDE.

The Toolbars tab allows you to select which toolbars to show. It also allows you to dock the toolbar in a different location in the IDE (top, bottom, left, and right). The Commands tab allows you to customize the menus, toolbars, and context menus (right-click). Figure 2.19 shows the Commands tab for working with the Standard toolbar.

You make customizations to the toolbar by selecting an item and choosing one of the option buttons on the right (move up, move down, delete, and so on). If things get messed up, you can use the Reset All button for a selected toolbar to revert to the default state.

Create a New Toolbar

The Toolbars tab on the Customize dialog box enables you to select which toolbars are visible. This dialog box also includes the New button, which enables you to create new toolbars to group existing commands. This gives you a great deal of customization options. After you’ve clicked the New button, you name your new toolbar. You then switch to the Commands tab and select the toolbar.

To add items to your new toolbar, you select the Add Command button, as shown in Figure 2.19. Figure 2.20 shows the Add Command dialog. Here you can access commands by categories. You select a command you want to add and click the OK button to complete the operation. You repeat this process until you have created your custom toolbar.

Image

FIGURE 2.20 Create a custom toolbar and add commands.

Assign Keyboard Shortcuts

You can also configure your keyboard shortcut combinations from the Customize dialog box. Use the Keyboard button (the bottom of Figure 2.19) to bring up the Options dialog box to the environment’s keyboard options screen. Figure 2.21 shows an example. First, you find a command from the list of hundreds; next, you set your cursor in the Press Shortcut Keys text box and press a shortcut key to map (or remap) a combination.

Image

FIGURE 2.21 Use the Keyboard options to assign (or modify) keyboard shortcuts to various IDE commands.

In Figure 2.21, the Build.Compile command is selected. The user is trying to assign the Ctrl+F10 shortcut key to the command (under “Press shortcut keys”). However, notice that Visual Studio lets you know that the Ctrl+F10 shortcut is already assigned to Debug.RunToCursor. Reassigning this shortcut is possible but may not be your intent.

You should do some exploration of your own into the many toolbars (and toolbar customization options) within Visual Studio. Often their usefulness presents itself only at the right moment. For instance, if you are editing a Windows form, having the Layout toolbar available to tweak the position of controls relative to one another can be a valuable timesaver. Knowing that these toolbars are available increases the likelihood that you can benefit from their value.

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

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