Reply to comment
Add Icon for Custom Control / Composite Control
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 ("paper-looking") 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.
I wrote an article a while back about how to add a control to your toolbox. You can read it here: Add a Composite Control to the Visual Studio Toolbox. To add an icon for your control, first create a Bitmap with the dimensions 16 pixels x 16 pixels and add it to your custom control project in the same exact directory where your control code files are. Name this Bitmap file the EXACT same name as your custom control but with a .bmp extension and make sure your Bitmap is 8 bit. For instance, if your control code was in a file called: "ModalDialogControl.cs", then you would name your Bitmap "ModalDialogControl.bmp".
Right-click on the Bitmap in Visual Studio Solution Explorer and choose "Properties". In the properties for the file, make sure to choose "Build Action" - "Embedded Resource".
Now in your control code, at the top of the class declaration for your control, place the attribute "ToolboxBitmap". Here is an example using the code for my ModalDialogControl class:
[System.Drawing.ToolboxBitmap(typeof(ModalDialogControl))] public class ModalDialogControl : CompositeControl { // my class implementation goes here... }
Now rebuild your project and re-add it to your toolbox. You should now see your icon next to your control in the toolbox window.
Reply
Popular Articles
Last viewed:
- Getting Started with Microsoft Chart Controls for ASP.NET 3.5
- GridView ObjectDataSource LINQ Paging and Sorting
- Data Access Layer using SqlDataReader and C#
- Disable Button on Submit (Prevent multiple submits)
- Fixing Relative Paths in C# ASP.NET When Using Url Rewriting
- Clustered Index vs. Non-Clustered Index in SQL Server

Recent comments
14 hours 23 min ago
1 day 14 hours ago
3 days 15 hours ago
4 days 4 hours ago
4 days 15 hours ago
4 days 21 hours ago
5 days 1 hour ago
1 week 21 hours ago
1 week 1 day ago
1 week 4 days ago