编写一个程序,当鼠标在窗体上移动时,能够绘出与光标移动轨迹相接近的图形
2013-11-12
展开全部
给你一个VB的代码,是一个简单实现画板的功能,希望可以帮到你。Dim aa As Integer'变量我随便定义的
Dim bb As Integer
Dim cc As Integer
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
aa = X
bb = Y
cc = 1
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If cc = 1 Then
Form1.Line (aa, bb)-(X, Y)
aa = X
bb = Y
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
cc = 0
End Sub
Private Sub qk_Click()'清除
Form1.Cls
End Sub
Private Sub tc_Click()'退出
End
End Sub
Dim bb As Integer
Dim cc As Integer
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
aa = X
bb = Y
cc = 1
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If cc = 1 Then
Form1.Line (aa, bb)-(X, Y)
aa = X
bb = Y
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
cc = 0
End Sub
Private Sub qk_Click()'清除
Form1.Cls
End Sub
Private Sub tc_Click()'退出
End
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询