|
1 | 1 | --- |
2 | 2 | title: "Converting Bitmaps to Toolbars (C++)" |
3 | 3 | ms.date: "11/04/2016" |
4 | | -helpviewer_keywords: ["bitmaps [C++], converting to toolbars", "Toolbar editor [C++], converting bitmaps", "toolbars [C++], converting bitmaps"] |
| 4 | +f1_keywords: ["vc.editors.newtoolbarresource"] |
| 5 | +helpviewer_keywords: ["bitmaps [C++], converting to toolbars", "Toolbar editor [C++], converting bitmaps", "toolbars [C++], converting bitmaps", "New Toolbar Resource dialog box [C++]"] |
5 | 6 | ms.assetid: 971c181b-40f5-44be-843d-677a7c235667 |
6 | 7 | --- |
7 | 8 | # Converting Bitmaps to Toolbars (C++) |
8 | 9 |
|
9 | | -You can create a new toolbar in a C++ project by converting a bitmap. The graphic from the bitmap converts to the button images for a toolbar. Usually the bitmap contains several button images on a single bitmap, with one image for each button. Images can be any size; the default is 16 pixels wide and the height of the image. You can specify the size of the button images in the [New Toolbar Resource dialog box](../windows/new-toolbar-resource-dialog-box.md) when you choose **Toolbar Editor** from the **Image** menu while in the Image editor. |
| 10 | +You can create a new toolbar in a C++ project by converting a bitmap. The graphic from the bitmap converts to the button images for a toolbar. Usually the bitmap contains several button images on a single bitmap, with one image for each button. Images can be any size; the default is 16 pixels wide and the height of the image. You can specify the size of the button images in the **New Toolbar Resource** dialog box when you choose **Toolbar Editor** from the **Image** menu while in the Image editor. |
10 | 11 |
|
11 | | -### To convert bitmaps to a toolbar |
| 12 | +The **New Toolbar Resource** dialog box allows you to specify the width and height of the buttons you're adding to a toolbar resource in a C++ project. The default is 16 × 15 pixels. |
12 | 13 |
|
13 | | -1. Open an existing bitmap resource in the [Image editor](../windows/image-editor-for-icons.md). (If the bitmap is not already in your .rc file, right-click the .rc file, choose **Import** from the shortcut menu, navigate to the bitmap you want to add to your .rc file, then click **Open**.) |
| 14 | +A bitmap that is used to create a toolbar has a maximum width of 2048. So if you set the **Button Width** to 512, you can only have four buttons. If you set the width to 513, you can only have three buttons. |
14 | 15 |
|
15 | | -2. From the **Image** menu, choose **Toolbar Editor**. |
| 16 | +The dialog box has the following properties: |
16 | 17 |
|
17 | | - The [New Toolbar Resource dialog box](../windows/new-toolbar-resource-dialog-box.md) appears. You can change the width and height of the icon images to match the bitmap. The toolbar image is then displayed in the Toolbar editor. |
| 18 | +|Property|Description| |
| 19 | +|---|---| |
| 20 | +|**Button Width**|Provides a space for you to enter the width for the toolbar buttons you're converting from a bitmap resource to a toolbar resource. The images are cropped to the width and height specified, and the colors are adjusted to use standard toolbar colors (16 colors).| |
| 21 | +|**Button Height**|Provides a space for you to enter the height for the toolbar buttons you're converting from a bitmap resource to a toolbar resource. The images are cropped to the width and height specified, and the colors are adjusted to use standard toolbar colors (16 colors).| |
18 | 22 |
|
19 | | -3. To finish the conversion, change the command **ID** of the button using the [Properties window](/visualstudio/ide/reference/properties-window). Type the new **ID** or select an **ID** from the drop-down list. |
| 23 | +For information on adding resources to managed projects, see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the *.NET Framework Developer's Guide*. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resource strings to properties, see [Creating Resource Files for Desktop Apps](/dotnet/framework/resources/creating-resource-files-for-desktop-apps). For information on globalization and localization of resources in managed apps, see [Globalizing and Localizing .NET Framework Applications](/dotnet/standard/globalization-localization/index). |
| 24 | + |
| 25 | +## To convert bitmaps to a toolbar |
| 26 | + |
| 27 | +1. Open an existing bitmap resource in the [Image editor](../windows/image-editor-for-icons.md). (If the bitmap isn't already in your .rc file, right-click the .rc file, choose **Import** from the shortcut menu, navigate to the bitmap you want to add to your .rc file, then select **Open**.) |
| 28 | + |
| 29 | +1. From the **Image** menu, choose **Toolbar Editor**. |
| 30 | + |
| 31 | + The **New Toolbar Resource** dialog box appears. You can change the width and height of the icon images to match the bitmap. The toolbar image is then displayed in the Toolbar editor. |
| 32 | + |
| 33 | +1. To finish the conversion, change the command **ID** of the button using the [Properties window](/visualstudio/ide/reference/properties-window). Type the new **ID** or select an **ID** from the drop-down list. |
20 | 34 |
|
21 | 35 | > [!TIP] |
22 | | - > The **Properties** window contains a pushpin button in the title bar. Clicking this button enables or disables **Auto Hide** for the window. To quickly cycle through all the toolbar button properties without having to reopen the individual property windows, turn **Auto Hide** off so the **Properties** window stays stationary. |
| 36 | + > The **Properties** window contains a pushpin button in the title bar. Selecting this button enables or disables **Auto Hide** for the window. To quickly cycle through all the toolbar button properties without having to reopen the individual property windows, turn **Auto Hide** off so the **Properties** window stays stationary. |
23 | 37 |
|
24 | 38 | You can also change the command IDs of the buttons on the new toolbar by using the [Properties window](/visualstudio/ide/reference/properties-window). For information on editing the new toolbar, see [Creating, Moving, and Editing Toolbar Buttons](../windows/creating-moving-and-editing-toolbar-buttons.md). |
25 | 39 |
|
26 | | -For information on adding resources to managed projects, please see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the *.NET Framework Developer's Guide*. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resource strings to properties, see [Creating Resource Files for Desktop Apps](/dotnet/framework/resources/creating-resource-files-for-desktop-apps). For information on globalization and localization of resources in managed apps, see [Globalizing and Localizing .NET Framework Applications](/dotnet/standard/globalization-localization/index). |
27 | | - |
28 | 40 | ## Requirements |
29 | 41 |
|
30 | 42 | MFC or ATL |
31 | 43 |
|
32 | 44 | ## See Also |
33 | 45 |
|
34 | 46 | [Creating New Toolbars](../windows/creating-new-toolbars.md)<br/> |
35 | | -[Toolbar Editor](../windows/toolbar-editor.md) |
| 47 | +[Toolbar Editor](../windows/toolbar-editor.md)<br/> |
| 48 | +[Toolbar Button Properties](../windows/toolbar-button-properties.md)<br/> |
0 commit comments