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

GDI+ - Need to Create a Ellipse shaped user Control with Smooth ed

P: n/a
Hi,

I need to create a Ellipse shaped user control which have folloiwng
attributes:
1) The edges are smooth
2) The control shuld only be selected when click on the ellipse shape & not
when click on the empty area of Client Rectangle

What I have done so far:
I override the OnPaintMethod as below:

protected override OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;

/*
Code to Draw Ellipse using Graphics Path
*/

//graphicsPath = Path on which Ellipse has been added
this.Region = new Region(graphicsPath)
}

Now if I uses the Code - this.Region = new Region(graphicsPath) - the
ellipse get distorted over its edges & if I remove the Code - this.Region =
new Region(graphicsPath) - I got a very smooth edged ellipse, however now the
ellipse shaped user control can be selected on the designer even by clicking
on the empty area of Client Rectangle.
I would be heartly thankful, if someone can give an idea to achieve both of
the above things - Smoothness & Restricted Selection - simultaneously.

Thanks in anticipation
Best Regards,
Pankaj Gaur
Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.