hamid Posted April 25, 2006 Posted April 25, 2006 i create a windows control and it is an advanced TextBox, now i want set a textbox icon for it that when i add it to my toolbox it shown as like as microsoft TextBox :rolleyes: Quote [ once4ever ]
Leaders snarfblam Posted April 25, 2006 Leaders Posted April 25, 2006 You need to use the System.Drawing.ToolBoxBitmapAttribute class. Imports System.Drawing <ToolboxBitmap(GetType(MyTextBox), "NameOfResource")> _ Public Class MyTextBox '... End Class using System.Drawing; [ToolboxBitmap(typeof(MyTextBox), "NameOfResource")] public class MyTextBox { // ... } There are different overloads, but this is probably the best. You pass the name of the resource and an object type in your assembly so the constructor can find the assembly to extract the resouce. The name of the resource isn't going to be the same as the name of the file. Depending on how it is added to the project, the name varies. It might be a good idea to compile the program, then decompile it with Reflector to find the name of the resource, then add the attribute. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.