Udostępnij za pośrednictwem


How to: Manipulate Toolbox Tabs

The Toolbox is a sliding tree control that behaves much like Windows Explorer, but without grid or connection lines. Multiple segments can be expanded simultaneously, and the entire tree scrolls inside of the Toolbox window.

Within the integrated development environment (IDE), you can drag icons from the Toolbox onto GUI designers and source code editors. Various methods are available to customize the appearance of Toolbox tabs and their items. For example, you can do the following:

  • Expand and collapse a single tab, or all tabs.

  • Add and remove custom tabs, and items on tabs.

  • Reposition and rename tabs and items.

  • Display items with or without labels.

  • Sort items alphabetically or display them in a custom order.

For more information on using the Toolbox window, see How to: Manage the Toolbox Window. Here are some common ways to manipulate Toolbox tabs and their items:

Toolbox Tab Procedures

To expand a Toolbox tab

  • Select the empty triangle symbol next to the name of the closed Toolbox tab.

To conceal a Toolbox tab

  • Select the filled triangle symbol next to the name of the expanded Toolbox tab.

To change the position of a Toolbox tab

  • Right-click on the name of the tab and choose Move Down or Move Up from its shortcut menu.

    — or —

  • Drag the tab to the desired position in the Toolbox, and release the mouse.

To rename a Toolbox tab

  1. In the Toolbox, right-click the desired tab, then choose Rename Tab from its shortcut menu.

  2. In the text box at the top of the tab, type a new name for the tab and press ENTER.

To add a custom Toolbox tab

  1. Right-click on the Toolbox and choose Add Tab from its shortcut menu.

    A new blank tab is added to the Toolbox.

  2. In the text box at the top of the new tab, type a name for the tab and press ENTER.

    The new tab appears at the bottom of the Toolbox. You can then position the new tab and add items to it.

    Tip

    Use custom tabs to store icons for preconfigured controls.

To remove a custom Toolbox tab

  1. Drag any icons you are still using to other Toolbox tabs.

  2. Right-click the Toolbox tab you no longer want, and choose Delete Tab.

    If any items are left on the tab, a message box informs you that those items will be deleted.

  3. Select OK to delete the selected tab from the Toolbox.

To display all available Toolbox tabs, regardless of context

  • Right-click on the Toolbox and choose Show All from its shortcut menu.

    Note

    Certain tabs and items might not be available in the current context. This option toggles on and off.

To restore all default Toolbox tabs, with their default icons

  • Right-click on the Toolbox and choose Reset Toolbox from its shortcut menu.

    — or —

  • On the Tools menu, click Choose Toolbox Items, and select the Reset button.

    Note

    After running this command, you will need to recreate any custom tabs, and add icons for the desired items to them.

To access Toolbox tabs that are not included in the .NET Client Profile

  1. In Solution Explorer, right-click on the project, and then click Properties.

  2. For Visual Basic projects, in the Compile tab, click Advanced Compile Options…, and then set Target Framework to .NET Framework 4.

    For all other project languages, in the Application tab, set Target Framework to .NET Framework 4.

Toolbox Item Procedures

To insert a Toolbox item at the selected location on the active designer

  • Double-click the desired item on the expanded Toolbox tab.

To store text or code in the Toolbox

  1. In the editor or designer, write the text or reconfigure the control to be reused.

  2. Select the desired text or code, and drag the selection onto the desired Toolbox tab.

    A line marks the position on the expanded tab where the new Toolbox icon will be created.

  3. Rename the new Toolbox icon as you wish.

    Tip

    For example, you might insert a standard Button control, define its style as you prefer, and then store this preconfigured code as a custom button template on the desired Toolbox tab.

To rename an item on a Toolbox tab

  1. In the Toolbox, right-click the desired item and choose Rename Item.

  2. In the text box, type a new name for the item, and then press ENTER.

To sort the items on a Toolbox tab alphabetically

  • In the Toolbox, right-click the desired tab, and then choose Sort Items Alphabetically.

    Note

    This option toggles on and off.

To display the icons on a Toolbox tab with or without labels

  • In the Toolbox, right-click the desired tab, and then choose List View.

    Note

    This option toggles on and off.

To reposition items on a Toolbox tab

  • Right-click on the item you wish to move within its Toolbox tab and choose Move Down or Move Up from its shortcut menu.

    — or —

  • Drag the item to the desired position within the tab, and release the mouse.

    Note

    When List View is deselected, Move Up shifts the selected icon to the previous position on the tab, and Move Down shifts it to the next position.

To move an item from one Toolbox tab to another

  • Drag the item from the expanded Toolbox tab onto another tab, or Cut the item and Paste it onto the desired tab.

    Note

    Items that cannot be moved are copied instead.

To copy an item from one Toolbox tab to another

  • Press the CTRL key and drag the item from the expanded Toolbox tab onto another tab.

    — or —

  • Copy the item and Paste it onto the name of the desired tab.

To add and remove items from the Toolbox

  1. On the Tools menu, click Choose Toolbox Items.

    The Choose Toolbox Items dialog box is displayed.

  2. In the Choose Toolbox Items dialog box, click from tab to tab to browse through available categories of Toolbox items.

  3. If you do not see an item that you need, click Browse to add items to the Choose Toolbox Items dialog box.

  4. Select any items you wish to add, and deselect those you wish to remove.

  5. Click OK.

    Icons for items selected in Choose Toolbox Items are now available in the Toolbox. You can drag any items added to the current tab to other tabs. Icons for items deselected in Choose Toolbox Items will no longer appear in the Toolbox.

    Note

    Some controls added to the Toolbox must be registered on your computer to be used in the IDE.

To remove a single item from the Toolbox

  • Select the Toolbox item and choose Delete from the Edit menu.

    Note

    Certain default items, such as the Pointer, cannot be removed.

See Also

Tasks

How to: Manage the Toolbox Window

Reference

Toolbox

Choose Toolbox Items Dialog Box (Visual Studio)