<

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Specifying a Toolbox Icon for a Custom Control using Visual Studio 2010

Published on
9,482 Points
3,282 Views
2 Endorsements
Last Modified:
Approved
When a custom control is placed on the toolbox, if it is a professionally made control, it usually has a really nice icon associated with it instead of the default custom control icon that Visual Studio inserts when no icon is available.  When you build your own custom control, you can add an icon for the control and embed it in your component's DLL assembly so that it is shown on the toolbox whenever someone adds your control.

you need to follow below steps to add icon in your custom control.

Step 1:

Create your icon and save it as a bmp file (16x16), named as shown below.

   ProjectNameSpace.ControlName.bmp

  e.g. Project Name : CustomGrid
        Control Name : MyGridControl

Bmp File Name :  CustomGrid.MyGridControl.bmp

Step 2: Add in Project and Change Build Action Properties to "Embedded Resources".

Stpe 3: Add ToolboxBitmap line in your class file as per screenshot.

 Toolbox Sample Code
Step 4 : Compile your Project as "Class Library".

Step 5:  Add this control in Different Solution Project Toolbox using choose items and icon will display like below ( In Same Project icon can not display).

Toolbox

Download Sample Project : CustomGrid.zip
2
0 Comments

Featured Post

OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Watch this online video tutorial and learn the best way to reduce Outlook mailbox size using Compact Now feature of Outlook. It removes the deletes item's space from Microsoft Outlook 2016, 2013, and 2010 and compresses the PST file size. This will …
Microsoft Office 365 Backup and Restore Solution by SysTools to export Office 365 mailbox to PST / EML file format on Windows OS. On Mac, tool backup O365 to PST / MBOX / MSG / EML / EMLX file formats. Not only this, restore option helps to import s…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month