Hello,
I am working with visual studio, dot net framework. I need to make a custome Button using C# code. I need a button control that will allow me to display multiple icons/bitmaps simultaneously.
Please help.
Hello,
I am working with visual studio, dot net framework. I need to make a custome Button using C# code. I need a button control that will allow me to display multiple icons/bitmaps simultaneously.
Please help.
Have a look at this page.
http://msdn.microsoft.com/library/de...bpowerpack.asp
Its for VB & you will need to convert it for C#.
Hope this helps!
An alternative is to create a new bitmap of appropriate size and draw an
icon in each corner of the bitmap. Then assign this new bitmap to the
buttons image property.
OR
Have a look at this page.
http://dotnetrix.co.uk/buttons.html
Try this code out.
Code:Rectangle BitmapRect = Rectangle.FromLTRB(0, 0, button1.Width, button1.Height); BitmapRect.Inflate(-6, -6); Bitmap srcImage = new Bitmap(@"c:\test.bmp"); srcImage.MakeTransparent(); Bitmap bmp = new Bitmap(BitmapRect.Width, BitmapRect.Height); Graphics g = Graphics.FromImage(bmp); //TopLeft corner g.DrawImage(srcImage, Point.Empty); //Topright corner g.DrawImage(srcImage, BitmapRect.Width - srcImage.Width, 0, srcImage.Width, srcImage.Height); //BottomLeft corner g.DrawImage(srcImage, 0, BitmapRect.Height - srcImage.Height, srcImage.Width, srcImage.Height); //BottomRight corner g.DrawImage(srcImage, BitmapRect.Width - srcImage.Width, BitmapRect.Height - srcImage.Height, srcImage.Width, srcImage.Height); button1.Image = new Bitmap(bmp); g.Dispose(); bmp.Dispose();
Bookmarks