Monday, July 27, 2009

How to add toolbox icon for the custom controls in .net?

Following steps are used in order to add the tool box icon for a custom control assembly:

1. Add the .bmp or .ico file for the image by adding an existing item by right clicking on the Solution explorer of the project.

2. The image and the custom control class should be in the same directory.

3. Add the System.Drawing namespace.

4. Add the following line of code above the class declaration

[ToolboxBitmap(typeof(Namespace.CustomClassName), "Image.bmp")]

5. Rebuild and Add with new dll into the Toolbox inorder to get the toolbox icon.

No comments:

Post a Comment