您可以使用ToolTipController控件,然后通过ToolTipController.GetActiveObjectInfo事件来设置ToolTip
关键代码:
private void toolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e)
{
if (e.SelectedControl is DevExpress.XtraTreeList.TreeList)
{
TreeList tree = (TreeList)e.SelectedControl;
TreeListHitInfo hit = tree.CalcHitInfo(e.ControlMousePosition);
if (hit.HitInfoType == HitInfoType.Cell)
{
object cellInfo = new TreeListCellToolTipInfo(hit.Node, hit.Column, null);
string toolTip = string.Format("{0} (Column: {1}, Node ID: {2})", hit.Node[hit.Column],
hit.Column.VisibleIndex, hit.Node.Id);
e.Info = new DevExpress.Utils.ToolTipControlInfo(cellInfo, toolTip);
}
}
}
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/138.html