Custom 3D, Irregular Shaped Buttons

What needs to be done in order to create a Non-Rectangular, Ireegular shaped button (from a Bitmap)

--Yatharth--




Answer this question

Custom 3D, Irregular Shaped Buttons

  • Ramana Kumar

    This will do only rectangular buttons right If my graphic has a transparent layer then how do I handle that

    --Yatharth--



  • Rena

    Then create a UserControl with a transpirant background, then it shouldn't be a problem.


  • QATester01

    When you don't want to do to fancy stuff you can just inhire the Button class and override the Paint method. Then just paint the Bitmap on the Button and you are done


    public class MyButton : Button
    {
    private Image _image;

    public MyButton()
    {
    _image = Image.FromFile( @"c:\image.bmp" );
    }

    protected override void OnPaint( PaintEventArgs e )
    {
    e.Graphics.DrawImage( _image, 0, 0, Widht, Height );
    }
    }




  • Custom 3D, Irregular Shaped Buttons