DevExpress ToolTipController implements the tooltip control and devexpress control.
1. Define a ToolTipController variable private ToolTipController _ mToolTipController = null;
2. encapsulated in a method
Protected void ToolTipController (GridControl gcData)
{
If (_ mToolTipController = null)
{
_ MToolTipController = new ToolTipController ();
}
If (_ mToolTipController = null) return;
If (gcData! = Null)
GcData. ToolTipController = _ mToolTipController;
_ MToolTipController. GetActiveObjectInfo + = toolTipController_GetActiveObjectInfo; // bind an event
}
// Event Method
Private void toolTipController_GetActiveObjectInfo (object sender, DevExpress. Utils. ToolTipControllerGetActiveObjectInfoEventArgs e)
{
GridControl gc = e. SelectedControl as GridControl;
If (gc = null) return;
ToolTipControlInfo info = null;
Try
{
GridView view = gc. GetViewAt (e. ControlMousePosition) as GridView;
If (view = null) return;
GridHitInfo hi = view. CalcHitInfo (e. ControlMousePosition );
If (hi. InRowCell)
{
Info = new ToolTipControlInfo (new CellToolTipInfo (hi. RowHandle, hi. Column, "cell"), GetCellHintText (view, hi. RowHandle, hi. Column ));
Return;
}
If (hi. HitTest = GridHitTest. RowIndicator)
{
Info = new ToolTipControlInfo (GridHitTest. RowIndicator. ToString () + hi. RowHandle. ToString (), "Row Handle:" + hi. RowHandle. ToString ());
Return;
}
}
Catch (Exception ex)
{
WriteExceptionLog (ex );
}
Finally
{
If (info! = Null) e. Info = info;
}
}
// Prompt message
Private string GetCellHintText (GridView view, int rowHandle, GridColumn gridColumn)
{
String displaytext = view. GetRowCellDisplayText (rowHandle, gridColumn );
Displaytext = "prompt message ";
Return displaytext;
}
3. Call
ToolTipController (gcData); // gcData is a list control
When you move the cursor to each cell, the following message is displayed: