When we add a custom control to the toolbox, you will find that all the control presets are the same icon, although the control icons do not change, however, we still want to add a proper coat to the custom control. This article describes how to set the Toolbox control icon.
1. Add the control icon file
First, prepare a 16x16 Bitmap (BMP), as shown below.
Add this graphic file to the server control project, as shown in. Use a specific data folder to store the diagrams of all toolboxes.
In the Properties window of the graph file, set the build action to "embedded resource 」.
2. Set the control icon
First, define a tbresource category, which is an empty category. The namespace must be the same as the root namespace and used as a reference resource file. Add the webresource definition of the control icon. Because the root namespace is bee. Web and the image name is tbbutton.bmp, the definition is as follows.
Suppose we want to set the tbbutton toolbox icon, apply toolboxbitmapattribute in the tbbutton category as follows. The first parameter is GetType (tbresource), and the second parameter is the file name.
Re-edit the Server Control Project and add the control of the bee. Web. dll component to the toolbox. You can see that the tbbutton icon has become a set icon.
Note: This article is also published in "the first it state help tie Ren Competition". If you think this articleArticleIt is helpful to you. Remember to add popularity when you connect to this article ^
Http://ithelp.ithome.com.tw/question/10011933