永发信息网

求VB中按住鼠标画曲线 放开鼠标则停止画图的代码

答案:2  悬赏:0  手机版
解决时间 2021-07-25 21:35
  • 提问者网友:雨不眠的下
  • 2021-07-25 13:33
求VB中按住鼠标画曲线 放开鼠标则停止画图的代码
最佳答案
  • 五星知识达人网友:七十二街
  • 2021-07-25 13:42

是移动鼠标画线的代码,做个参考


Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.ForeColor = vbRed
Picture1.DrawWidth = 5
Picture1.PSet (X, Y)
End Sub
Private Sub Form_Load()
Me.Height = 5000
Me.Width = 5000
Picture1.Height = 4998
Picture1.Width = 4998
End Sub

全部回答
  • 1楼网友:未来江山和你
  • 2021-07-25 15:03

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

if (button and 1)=0 then exit sub ' 加上这个可以实现按下才画 Picture1.PSet (X, Y) End Sub Private Sub Form_Load() Me.Height = 5000 Me.Width = 5000 Picture1.Height = 4998 Picture1.Width = 4998

Picture1.ForeColor = vbRed'这两行没必要放在mousemove中

Picture1.DrawWidth = 5 End Sub

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯