Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Self made Button In C#

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 06-02-2009
Member
 
Join Date: Jan 2009
Posts: 9
Self made Button In C#
  

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.

Reply With Quote
  #2  
Old 06-02-2009
Member
 
Join Date: May 2008
Posts: 40
Re: Self made Button In C#

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!
Reply With Quote
  #3  
Old 06-02-2009
Member
 
Join Date: May 2008
Posts: 27
Re: Self made Button In C#

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
Reply With Quote
  #4  
Old 06-02-2009
Member
 
Join Date: May 2008
Posts: 63
Re: Self made Button In C#

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();
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Self made Button In C#"
Thread Thread Starter Forum Replies Last Post
How to use the G button in LG optimus black to lock screen or as camera button Zh@veri Portable Devices 7 05-12-2011 09:25 PM
Trackpad button and the left mouse button of my MacBook is not working Eun Portable Devices 12 27-09-2011 12:01 AM
InPrivate Browsing the go button and File button Open are not working Afiq Technology & Internet 3 06-04-2011 09:24 AM
Mute button and PowerCinema Button don't work Appaji Hardware Peripherals 4 09-04-2010 06:37 AM
Convert Sleep Button in Shutdown button In Vista Kraker999 Customize Desktop 3 20-03-2009 12:45 AM


All times are GMT +5.5. The time now is 01:50 AM.