我们如何绘制一个空的(或类似的东西) [英] how can we Drawing a Empty(or something like this)

查看:83
本文介绍了我们如何绘制一个空的(或类似的东西)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用此代码绘制图片.链接:

链接: http://up3.iranblog.com/images/jjx4pf5qpbocceymr1.png [

Hi

I Using this code for draw a pic. Link:

Link:http://up3.iranblog.com/images/jjx4pf5qpbocceymr1.png[^]


Dim x As Integer = 2
        Dim y As Integer = 2
        Dim w As Integer = 400
        Dim h As Integer = 400
        Dim r As Integer = 30



        Dim path As GraphicsPath = New GraphicsPath()
        path.AddArc(x, y, r, r, 180, 90)
        path.AddLine(x + r, y, x + w - r, y)

        path.CloseFigure()

推荐答案

只需使用Graphics.DrawPath:
Just use Graphics.DrawPath:
Dim x As Integer = 2
Dim y As Integer = 2
Dim w As Integer = 400
'int h = 400;
Dim r As Integer = 30

Dim path As New System.Drawing.Drawing2D.GraphicsPath()
path.AddArc(x, y, r, r, 180, 90)
path.AddLine(x + r, y, x + w - r, y)

path.CloseFigure()
g.DrawPath(Pens.Red, path)

如果要处理Paint事件,则可以从PaintEventArgs参数Graphics属性获取上下文.否则,您需要为要绘制的项目创建Graphics对象,并在完成后将其处理.

If you are handling the Paint event, your can get the context from the PaintEventArgs parameters Graphics property. Otherwise you need to create the Graphics object for the item you are drawing onto, and Dispose it when you are finished.


这篇关于我们如何绘制一个空的(或类似的东西)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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