

Introduction
I have always hated the so called "focused rectangle" Windows draws on push buttons having the focus. So I decided to derive my own class that does not display such a
rectangle. Later I put an image support for the button and that's how it began.
Using the code
In the download is the whole solution, so you have just to unzip it and start
Controls.sln and see all the files of the project (I suppose you have Visual Studio.NET).
Then you may create your own push buttons from the "But" class. I supplied three different constructors for it. The first one uses a bitmap object to display on the button:
public But(string str, Bitmap bitmap, int cx, int cy)
{
ResizeRedraw = true;
txt = str; bmp = bitmap; bmp.MakeTransparent();
MeasureSizes(cx, cy);}
The next is working with icon:
public But(string str, System.Drawing.Icon ico, int cx, int cy, int IconWidth, int IconHeight)
{
ResizeRedraw = true;
txt = str;
ico = new Icon(ico, IconWidth, IconHeight);
bmp = ico.ToBitmap();
bmp.MakeTransparent();
MeasureSizes(cx, cy);
}
And the last one (I use mostly) is without specifying cx and cy (in
MeasureSizes function I supply the minimum size required for proper displaying of the button)
public But(string str, System.Drawing.Icon ico, int IconWidth, int IconHeight)
{
ResizeRedraw = true;
txt = str;
ico = new Icon(ico, IconWidth, IconHeight);
bmp = ico.ToBitmap();
bmp.MakeTransparent();
MeasureSizes(Width, Height);
Well, that's it! I hope being useful with my owner-drawn button:)