vb6.0 在picturebox中鼠标画线,并把点动态存储到mshflexgrid控件中
展开全部
搜一下:vb6.0
在picturebox中鼠标画线,并把点动态存储到mshflexgrid控件中
在picturebox中鼠标画线,并把点动态存储到mshflexgrid控件中
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
添加一个picture和MSFlexGrid
Dim PotXtemp, PotYtemp, Draw As Boolean
Private Sub Form_Load()
With MSFlexGrid1
.TextMatrix(0, 0) = "X"
.TextMatrix(0, 1) = "Y"
End With
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Draw = True
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Draw = True Then
If PotXtemp = "" And PotYtemp = "" Then
PotXtemp = X
PotYtemp = Y
Else
Picture1.Line (PotXtemp, PotYtemp)-(X, Y)
PotXtemp = X
PotYtemp = Y
End If
With MSFlexGrid1
.Rows = .Rows + 1
.TextMatrix(.Rows - 2, 0) = X
.TextMatrix(.Rows - 2, 1) = Y
End With
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Draw = False
PotXtemp = ""
PotYtemp = ""
End Sub
Dim PotXtemp, PotYtemp, Draw As Boolean
Private Sub Form_Load()
With MSFlexGrid1
.TextMatrix(0, 0) = "X"
.TextMatrix(0, 1) = "Y"
End With
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Draw = True
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Draw = True Then
If PotXtemp = "" And PotYtemp = "" Then
PotXtemp = X
PotYtemp = Y
Else
Picture1.Line (PotXtemp, PotYtemp)-(X, Y)
PotXtemp = X
PotYtemp = Y
End If
With MSFlexGrid1
.Rows = .Rows + 1
.TextMatrix(.Rows - 2, 0) = X
.TextMatrix(.Rows - 2, 1) = Y
End With
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Draw = False
PotXtemp = ""
PotYtemp = ""
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询