Vb6 如何确定网格中的哪个单元格鼠标指针位于上方? Private Sub-Grid1\u MouseMove(按钮为整数,移位为整数,X为单个,Y为单个) 如果????????????然后Grid1.ToolTipText= 端接头
如何使用Vb6 如何确定网格中的哪个单元格鼠标指针位于上方? Private Sub-Grid1\u MouseMove(按钮为整数,移位为整数,X为单个,Y为单个) 如果????????????然后Grid1.ToolTipText= 端接头,vb6,grid,tooltip,coordinates,mousemove,Vb6,Grid,Tooltip,Coordinates,Mousemove,如何使用X和Y坐标来确定鼠标指针当前在哪个单元格上 我使用的Grid的实现只有MouseMove事件,而没有MouseOver事件。私有子网格1\u MouseMove(按钮为整数,移位为整数,x为单,y为单) Private Sub Grid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If ???????????? Then Grid1.ToolTipText = <c
X
和Y
坐标来确定鼠标指针当前在哪个单元格上
我使用的Grid
的实现只有MouseMove
事件,而没有MouseOver
事件。私有子网格1\u MouseMove(按钮为整数,移位为整数,x为单,y为单)
Private Sub Grid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If ???????????? Then Grid1.ToolTipText = <contents of cell>
End Sub
Dim intRow为整数,intCol为整数
用Grid1
对于intRow=0到.Rows-1
如果y>.RowPos(intRow),则
如果y<.RowPos(intRow)+.RowHeight(intRow),则
对于intCol=0到.Cols-1
如果x>.ColPos(intCol),则
如果x<.ColPos(intCol)+.ColWidth(intCol),则
.ToolTipText=.TextMatrix(intRow,intCol)
如果结束
如果结束
下一个intCol
如果结束
如果结束
下一篇介绍
以“Grid1”结尾
端接头
有点野蛮,但做这项工作
Private Sub Grid1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim intRow As Integer, intCol As Integer
With Grid1
For intRow = 0 To .Rows - 1
If y > .RowPos(intRow) Then
If y < .RowPos(intRow) + .RowHeight(intRow) Then
For intCol = 0 To .Cols - 1
If x > .ColPos(intCol) Then
If x < .ColPos(intCol) + .ColWidth(intCol) Then
.ToolTipText = .TextMatrix(intRow, intCol)
End If
End If
Next intCol
End If
End If
Next intRow
End With 'Grid1
End Sub