使用innerRing绘制多边形。 [英] Draw polygon with innerRing.

查看:147
本文介绍了使用innerRing绘制多边形。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题如下。



我有2个点数组。在图形中我需要绘制多边形(数组1)而不绘制内部(数组2),如此图像。



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



任何想法如何在C #?

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#?

推荐答案

你好,我找到了解决办法。



在图形中我更改了 CompositingMode ,它确定何时在另一个上绘制多边形,它被覆盖而不是叠加。





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.


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!


这篇关于使用innerRing绘制多边形。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆