2024年终活动

DevExpress控件使用交流,DevExpress中国社区Dev联系电话 联系电话:023-68661681

怎样在DevExpress XtraTreeList中设置ToolTip?

来源:本站   发布时间:2012-03-01   浏览:3692次

您可以使用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
扫码咨询
电话咨询
023-68661681
返回
顶部