Results 1 to 4 of 4

Thread: Self made Button In C#

  1. #1
    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.

  2. #2
    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!

  3. #3
    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

  4. #4
    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();

Similar Threads

  1. Replies: 7
    Last Post: 05-12-2011, 09:25 PM
  2. Replies: 12
    Last Post: 26-09-2011, 11:01 PM
  3. Replies: 3
    Last Post: 06-04-2011, 08:24 AM
  4. Mute button and PowerCinema Button don't work
    By Appaji in forum Hardware Peripherals
    Replies: 4
    Last Post: 09-04-2010, 05:37 AM
  5. Convert Sleep Button in Shutdown button In Vista
    By Kraker999 in forum Customize Desktop
    Replies: 3
    Last Post: 19-03-2009, 11:45 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,679,594.87908 seconds with 17 queries