[ToolboxBitmap(typeof(Button))]
class MyControl1 : UserControl
{
}
// Specifies a bitmap file.
[ToolboxBitmap(@"C:\Documents and Settings\Joe\MyPics\myImage.bmp")]
class MyControl2 : UserControl
{
}
// Specifies a type that indicates the assembly to search, and the name
// of an image resource to look for.
[ToolboxBitmap(typeof(MyControl), "MyControlBitmap")]
class MyControl : UserControl
{
}
You could also adding a 16*16 256color bmp file with the
same name as the control (except for the extensions) will do
the trick. Otherwize just add it to your project as an embedded
resource and use the following
[ToolboxBitmap(typeof(MyControl), "NameOfBitmap")]
class MyControl : UserControl
{
}
Thank you very much for that quick reply, it really helps a lot. I just
have one more favor to ask, what books or web site can you recommend for
me that contains lots of stuff about creating custom controls using C#.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.