[Implementing the ASP. Net Control as day7] setting the control icon of the toolbox

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.