Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GDI+ nonrectangular forms - what am i doing wrong?

Status
Not open for further replies.

esdee

Programmer
Apr 12, 2001
143
US
i have this in the form constructor:
Code:
			GraphicsPath p = new GraphicsPath();

			Point[] points = {   new Point(0, 0), new Point(100, 0),
								 new Point(150, 50), new Point(250, 50),
								 new Point(250, 350), new Point(0, 350) };

			p.AddPolygon(points);
			this.Region = new Region(p);

which creates a poligonal form.
i want to have the upper part colored, and im using the same coordinates, like:
Code:
Graphics g = e.Graphics;
Point[] points = {   new Point(0, 0), new Point(100, 0),
								 new Point(150, 50), new Point(0, 50)};
Rectangle r = new Rectangle(points); 
g.FillRectangle(new SolidBrush(Color.Aqua), r);

but the colored part doesnt match the part of the window i want! do i have to make coordinates shift or something? i tried rectangletoscreen etc but nothing worked ...
 
somehow i have marked this one as a news topic...sorry :(

------------------------
dev at viewmoresoft.com
tools for your database
 
I think you need to subdivide it into two separate regions that adjoin each other along a common edge, rather than overlaying one on top of the other.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
it is not two regions - it only one, and want a prt of it to be fill with some color. the problem is there is a mismatch of the coordinates: when using
Code:
new Point(0, 0), new Point(100, 0), 
new Point(150, 50), new Point(250, 50)
to define a part of the region, and then use the same part for the fill - they dont match ! i mean the filled part is not what i expect.
 
Try my idea and get back to me.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top