用VB编写画图程序

用VB编写画图程序,第1张

提供一个绘制任意曲线的简单代码。其他功能类似,希望能举一反三。

在窗兄陵体中添加一个Picture box,然后输入命令如下:

Dim oldx As Single

Dim 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

Picture1控件是不能透明野橘告的伍差 但是颂明Picture控件支持画

Dim X1 As Single

Dim Y1 As Single

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbLeftButton Then

X1 = X

Y1 = Y

End If

End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbLeftButton Then

Picture1.Line (X1, Y1)-(X, Y)

X1 = X

Y1 = Y

End If

End Sub

无悬赏,无锋巧详解:历基郑

Private Sub Command1_Click()

Shell "C:\肢颂WINDOWS\system32\mspaint.exe", vbMaximizedFocus

End Sub

觉得OK:::


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/12276644.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-22
下一篇2023-05-22

发表评论

登录后才能评论

评论列表(0条)

    保存