Non-rectangular forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I'm working on a project with a non-rectangular form. I found that if in the form constructor I define a region, say

GraphicsPath p = new GraphicsPath()
p.AddEllipse(20, 20, 200, 200)
this.Region = new Region(p)

I get a shaped form with no non-client areas which is exactly what I want.
My problem is I don't understand WHY this works. Shouldn't the OnPaint event override my code
I'd be grateful for any explanation of what's going on here

Regard

Tony Reynolds
 
The region supplied to the form creates a clipping area that you cannot
paint outside of. If you could it would be possible to draw a line
from -1000, 100 to 1000,100 and it would go right across the desktop. This
clearly isn't the case.

Normal windows have a rectangular clipping region, in the case of a shaped
form the rectangle is replaced by whatever you assign.

--
Bob Powell [MVP]
C#, System.Drawing

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

Tony Reynolds said:
Hi -

I'm working on a project with a non-rectangular form. I found that if in
the form constructor I define a region, say,
 
Back
Top