Click here to Skip to main content
15,886,049 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
The problem is the following.

I have 2 arrays of points. In a graphics I need to paint the polygon (array 1) without painting the inside (array 2), As this image.

http://wiki.openstreetmap.org/w/images/thumb/b/b4/Multipolygon_Illustration_1.svg/400px-Multipolygon_Illustration_1.svg.png[^]

Any idea how to do this in C#?
Posted
Updated 30-Jan-13 0:04am
v2

1 solution

hello, I found the solution.

In graphics I changed the CompositingMode that determines when to paint a polygon on the other it is overwritten and not superimposed.


C#
Bitmap img = new Bitmap( 200, 200 );
Graphics imgGraph = Graphics.FromImage( img );
imgGraph.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
imgGraph.FillPolygon( Brushes.Red, Points1 );
imgGraph.FillPolygon( Brushes.Transparent, Points2 );





That's all folks!
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900