By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,084 Members | 1,969 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,084 IT Pros & Developers. It's quick & easy.

round or oval shaped buttons using C#

P: 1
hii...
plz help me out ,how to create rounded or oval buttons using c# in VS 2005.
Dec 9 '08 #1
Share this Question
Share on Google+
3 Replies


nukefusion
Expert 100+
P: 221
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
Expert 5K+
P: 7,872
That same concept can be applied to custom shaped forms.
Dec 9 '08 #3

P: 2
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.