How to change default image of derived ToolStripButton?
Posted
by Special Touch
on Stack Overflow
See other posts from Stack Overflow
or by Special Touch
Published on 2009-08-27T16:04:56Z
Indexed on
2010/04/14
4:03 UTC
Read the original article
Hit count: 474
It seems like a simple task. Create a C# class that derives from ToolStripButton. The derived ToolStripButton should behave exactly the same as the parent class in the designer and the application, except that the default image should be different.
Surprisingly just changing the constructor is not sufficient:
public CustomToolStripButton()
{
base.Image = (Image) new Bitmap(typeof(CustomToolStripButton), "CustomImage.bmp");
}
When the ToolStripButton is displayed in the designer, the original default image is shown. There must be a simple solution. What could it be?
© Stack Overflow or respective owner