DevExpress ToolTipController implements the tooltip control and devexpress control.

Source: Internet
Author: User

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:

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.