terrydiederich2
1/10/2019 - 3:22 PM

DevExpress ToolTips on Columns

First add the ToolTipController component onto the form.

Set the ToolTipController property of the GridControl to point to the ToolTipController component.

Create an event handler for the ToolTipController's GetActiveObjectInfo event

Private Sub toolTipController1_GetActiveObjectInfo(ByVal sender As Object, ByVal e As ToolTipControllerGetActiveObjectInfoEventArgs) Handles toolTipController1.GetActiveObjectInfo
  If e.Info Is Nothing AndAlso e.SelectedControl Is gridControl1 Then
    Dim view As GridView = TryCast(gridControl1.FocusedView, GridView)
    Dim info As GridHitInfo = view.CalcHitInfo(e.ControlMousePosition)
    If info.InRowCell Then
      Dim text As String = view.GetRowCellDisplayText(info.RowHandle, info.Column)
      Dim cellKey As String = info.RowHandle.ToString() & " - " & info.Column.ToString()
      e.Info = New DevExpress.Utils.ToolTipControlInfo(cellKey, text)
    End If
  End If
End Sub

This example will display the contents of each column when the mouse hoovers over the cell. To set the ToolTip for a specific column, check for the column name. For example

If info.InRowCell Then
  If info.Column.Name = "colOrderNumber" then
    cellKey = info.RowHandle.ToString() & " - " & info.Column.ToString()
    e.Info = New DevExpress.Utils.ToolTipControlInfo(cellKey, "This is the Order Number column")
  End If
End If