468,550 Members | 2,300 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,550 developers. It's quick & easy.

round or oval shaped buttons using C#

hii...
plz help me out ,how to create rounded or oval buttons using c# in VS 2005.
Dec 9 '08 #1
3 17144
nukefusion
221 Expert 100+
Probably the easiest way is to set the region of the button. Subclass Button and adjust the Region with code similar to this:

Expand|Select|Wrap|Line Numbers
  1.  public class ShapedButton : Button
  2.     {
  3.         protected override void OnResize(EventArgs e)
  4.         {
  5.             base.OnResize(e);
  6.             GraphicsPath gp = new GraphicsPath();
  7.             gp.AddEllipse(new Rectangle(Point.Empty, this.Size));
  8.             this.Region = new Region(gp);
  9.         }
  10.     }
Dec 9 '08 #2
Plater
7,872 Expert 4TB
That same concept can be applied to custom shaped forms.
Dec 9 '08 #3
here is a solution I saw recently...
http://www.youtube.com/watch?v=K_JzL4kzCoE
Feb 1 '13 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Poker Man | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.