Returns the zero-based index of the column under the mouse pointer.
Syntax
val& = [form!]VSFlexGrid.MouseCol
Remarks
The MouseRow and MouseCol properties are useful when handling the BeforeMouseDown event, because it is fired before the selection is updated. They are also useful when handling other mouse events that do not change the selection, such as mouse moves while the left button is not pressed. Finally, they are also good for detecting clicks on the fixed areas of the grid.
The code below will highlight the current column when the mouse is moved over a non-fixed cell.
Private Sub fg_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
fg.Cell(flexcpBackColor, fg.FixedRows, fg.FixedCols, fg.Rows - 1, fg.Cols - 1) = vbDefault
If fg.MouseRow >= fg.FixedRows And fg.MouseCol >= fg.FixedCols Then
fg.Cell(flexcpBackColor, fg.FixedRows, fg.MouseCol, fg.Rows - 1, fg.MouseCol) = vbYellow
End If
End Sub
Typical uses for these properties include displaying help information or ToolTips when the user moves the mouse over a selection, and the implementation of manual drag-and-drop manipulation of OLE objects.
Note
MouseRow and MouseCol return -1 if they are invoked while the mouse is not over the control or is over the empty area of the control.
Data Type
Long