189 8069 5689

vb.net绘图程序,vb绘图控件

跪求vb.net代码

新建窗口,添加picture控件

网站建设哪家好,找创新互联!专注于网页设计、网站建设、微信开发、微信小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了潘集免费建站欢迎大家使用!

利用line()方法画线

line(开始x坐标,开始y坐标)-(结束x坐标,结束y坐标),线的颜色,画线的方式(默认为线,B为矩形无填充,BF为填充的矩形)

For i = 1 To 16

Picture1.Line (0, Picture1.Height / 2)-(i * (Picture1.Width / 16), 0), RGB(255, 0, 0)

Picture1.Line (0, Picture1.Height / 2)-(i * (Picture1.Width / 16), Picture1.Height), RGB(255, 0, 0)

Picture1.Line (Picture1.Width, Picture1.Height / 2)-(i * (Picture1.Width / 16), 0), RGB(0, 255, 0)

Picture1.Line (Picture1.Width, Picture1.Height / 2)-(i * (Picture1.Width / 16), Picture1.Height), RGB(0, 255, 0)

Next i

如果要在窗口上画也可以调用窗口的line方法即form.line()

如何使用vb.net调用cad进行绘图

你去查查书吧,书上挺详细的,在这说不好说,你先在项目里引用。然后 Dim acadapp As AcadApplication Dim acaddoc As AcadDocument On Error Resume Next AcadApp = GetObject(, "AutoCAD.Application") If Err.Number Then Err.Clear() AcadApp = CreateObject("AutoCAD.Application") If Err.Number Then MsgBox("不能运行AutoCAD,请检查是否安装了AutoCAD") Exit Sub End If End If AcadApp.Visible = True '界面可视

VB.Net如何实现抠图并绘图

项目中要用图形来显示一个阀门的开度,以及控制阀的开度。本来是要用什么公司买的控件中的饼图之类的实现,不过我觉得也是麻烦,就想,还是自己画吧。

首先添加一个TrackBar,名字是“TrackBar1”,一个label,名字是“L_A_SHANG”,一个GroupBox,名字是“GB_RIGHT”,,然后添加拉动滚动条时的处理函数

'上位机控制

Dim m_start As Integer

Dim RcDraw As System.Drawing.Rectangle

Private Sub TrackBar1_Scroll(ByVal sender As Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll

m_start = (100 - TrackBar1.Value)

Me.L_A_SHANG.Text = Me.TrackBar1.Value.ToString

GB_RIGHT.Invalidate() '重画GB_RIGHT

End Sub

添加GB_RIGHT重画时的处理函数

Private Sub GB_RIGHT_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles GB_RIGHT.Paint

RcDraw.X = TrackBar1.Location.X - 40

RcDraw.Y = 20

RcDraw.Height = 100

RcDraw.Width = 20

e.Graphics.DrawRectangle(New Pen(Color.Blue, 5), RcDraw)

Dim i = TrackBar1.Location.X - 40

For i = TrackBar1.Location.X - 40 To TrackBar1.Location.X - 20

e.Graphics.DrawLine(New Pen(Color.Blue, 5), i, m_start + 20, i, 120)

Next

Me.L_A_SHANG.Text = Me.TrackBar1.Value.ToString + "%"

End Sub

到此以及可以实现拉动条的时候,图像跟着变化,并显示百分比。

VB.net中如何画图?

VB.net与VB不同。

VB.net已经有专门绘图的类。

可以定义笔刷然后用Drawing类中的方法绘制。

Private Sub DrawEllipse()

Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)

Dim formGraphics as System.Drawing.Graphics

formGraphics = Me.CreateGraphics()

formGraphics.DrawEllipse(myPen, New Rectangle(0,0,200,300))

myPen.Dispose()

formGraphics.Dispose()

End Sub

Private Sub DrawRectangle()

Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)

Dim formGraphics as System.Drawing.Graphics

formGraphics = Me.CreateGraphics()

formGraphics.DrawRectangle(myPen, New Rectangle(0,0,200,300))

myPen.Dispose()

formGraphics.Dispose()

End Sub


网页名称:vb.net绘图程序,vb绘图控件
标题URL:http://jkwzsj.com/article/hsjidh.html

其他资讯