C# GDI Drawing2D 帮助
我可以使用哪些 GDI 方法来绘制下图中所示的蓝色形状?中心必须是透明的。
What GDI methods can I use to draw the blue shape shown in the image below? The center must be transparent.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有多种方法,但您可能需要使用以下方法:
因为看起来您的形状可以简化为一个矩形和两个多边形,然后用几条线勾勒出轮廓。
这是我的想法的一个非常简单且硬编码的示例:
...
There are a number of ways but you'll probably want to use the following:
since it looks like your shape can be reduced to a rectangle and two polygons and then outlined by a few lines.
Here is a really simple and hard-coded example of what i was thinking:
...
我假设 GDI+ 又名 System.Drawing 命名空间。
最好的办法是查看 System.Drawing.Drawing2d.GraphicsPath 类:
http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.graphicspath.aspx
您需要确保关闭路径以获得空心效果。
Im assuming GDI+ here aka System.Drawing namespace.
The best thing to do is to look at System.Drawing.Drawing2d.GraphicsPath class :
http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.graphicspath.aspx
You need to make sure you close the path to get the hollow effect.
使用位图绘制不是更容易吗?无论如何,这就是他们的目的:)。
Wouldn't it just be easier to draw it using a bitmap? That's what they're for anyway :).