* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
3.1 KiB
title, ms.date, helpviewer_keywords, ms.assetid
| title | ms.date | helpviewer_keywords | ms.assetid | ||||||
|---|---|---|---|---|---|---|---|---|---|
| How to: Define an Icon for a ToolBar Button Using the Designer | 03/30/2017 |
|
d848f38e-67f2-49d4-8e88-01c845c06c02 |
How to: Define an Icon for a ToolBar Button Using the Designer
Note
The xref:System.Windows.Forms.ToolStrip control replaces and adds functionality to the xref:System.Windows.Forms.ToolBar control; however, the xref:System.Windows.Forms.ToolBar control is retained for both backward compatibility and future use, if you choose.
xref:System.Windows.Forms.ToolBar buttons are able to display icons within them for easy identification by users. This is achieved through adding images to the xref:System.Windows.Forms.ImageList component and associating it with the xref:System.Windows.Forms.ToolBar control.
The following procedure requires a Windows Application project with a form containing a xref:System.Windows.Forms.ToolBar control and an xref:System.Windows.Forms.ImageList component. For information about setting up such a project, see How to: Create a Windows Forms application project and How to: Add Controls to Windows Forms.
To set an icon for a toolbar button at design time
-
Add images to the xref:System.Windows.Forms.ImageList component. For more information, see How to: Add or Remove ImageList Images with the Designer.
-
Select the xref:System.Windows.Forms.ToolBar control on your form.
-
In the Properties window, set the xref:System.Windows.Forms.ToolBar control's xref:System.Windows.Forms.ToolBar.ImageList%2A property to the xref:System.Windows.Forms.ImageList component.
-
Click the xref:System.Windows.Forms.ToolBar control's xref:System.Windows.Forms.ToolBar.Buttons%2A property to select it, and click the ellipsis (
) button to open the ToolBarButton Collection Editor. -
Use the Add button to add buttons to the xref:System.Windows.Forms.ToolBar control.
-
In the Properties window that appears in the pane on the right side of the ToolBarButton Collection Editor, set the xref:System.Windows.Forms.ToolBarButton.ImageIndex%2A property of each toolbar button to one of the values in the list, which is drawn from the images you added to the xref:System.Windows.Forms.ImageList component.