round or oval shaped buttons using C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • potupaul
    New Member
    • Dec 2008
    • 1

    round or oval shaped buttons using C#

    hii...
    plz help me out ,how to create rounded or oval buttons using c# in VS 2005.
  • nukefusion
    Recognized Expert New Member
    • Mar 2008
    • 221

    #2
    Probably the easiest way is to set the region of the button. Subclass Button and adjust the Region with code similar to this:

    Code:
     public class ShapedButton : Button
        {
            protected override void OnResize(EventArgs e)
            {
                base.OnResize(e);
                GraphicsPath gp = new GraphicsPath();
                gp.AddEllipse(new Rectangle(Point.Empty, this.Size));
                this.Region = new Region(gp);
            }
        }

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      That same concept can be applied to custom shaped forms.

      Comment

      • murathankocan
        New Member
        • Mar 2007
        • 2

        #4
        here is a solution I saw recently...

        Comment

        Working...