VSFlexGrid Tutorials > ToolTip Demo |
The example below shows how you can use the MouseRow and MouseCol properties to implement tooltips with text that changes as the mouse moves over the control.
Example Title |
Copy Code
|
---|---|
Sub fg_MouseMove(Button As Integer, Shift As Integer, _ X As Single, Y As Single) Static r As Long, c As Long Dim nr As Long, nc As Long ' get coordinates nr = fg.MouseRow nc = fg.MouseCol ' update tooltip text If c <> nc Or r <> nr Then r = nr c = nc fg.ToolTipText = "Row:" & r & " Col:" & c End If ' other processing... ' ... End Sub |
The code keeps track of the last cell for which tooltips were displayed, and refreshes the ToolTipText only when needed. This is done to avoid flicker.