提供一个绘制任意曲线的简单代码。其他功能类似,希望能举一反三。
在窗兄陵体中添加一个Picture box,然后输入命令如下:
Dim oldx As SingleDim oldy As Single
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then 饥尘慎 '当鼠标左建按下时发生
Picture1.Line (oldx, oldy)-(X, Y)
oldx = X
oldy = Y
End If
End Sub
Private Sub Picture1_Mousedown(Button As Integer, Shift As Integer, X As Single, Y As 烂敬Single)
oldx = X
oldy = Y
End Sub
分类: 电脑/网络 >>程序设计 >>其他编程语言枝渣改问题描述:
VB6中的form1.circle (100,200),rgb(0,255,0)的语句如何在VB中使用啊?
急用啊!梁早!!!!!!!
解析:
VB与VB不同。
VB已经有专门绘图的类。
可以定义笔刷然后用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
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)