Changing the Shape of Button Programatically

  • Thread starter Thread starter AJ
  • Start date Start date
A

AJ

Hi guys,
any clues or suggesstion on how to programatically change the shape of
a button from rectangular to say elliptical or circular. Meaning that
when the mouse hovers just within the shape, only then the Click event
can be generated.
Would be Great if you guys can help

Code can be either in C# or VB.Net
Thanx
AJ
 
You can use the GraphicsPath class to define the shape and then use the
Region class to turn that shape into a clipping region that can be assigned
to a control...

GraphicsPath gp = new GraphicsPath();
gp.AddEllipse(0, 0, this.button1.ClientSize.Width,
this.button1.ClientSize.Height);
this.button1.Region = new Region(gp);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top