//窗体添加 控件 ,然后将GridControl 相关属性栏对应上新加的控件 切记  本文是转帖,稍作修改    
private void toolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e)
        {
            this.gridControl1.ToolTipController = tip;
            if (e.SelectedControl != gridControl1) return;

            ToolTipControlInfo info = null;

            GridView view = gridControl1.GetViewAt(e.ControlMousePosition) as GridView;
            if (view == null) return;


            GridHitInfo hi = view.CalcHitInfo(e.ControlMousePosition);

            //if (hi.HitTest == GridHitTest.RowIndicator)// 我测试时要注掉这行才搞定
            //{ 
            //An object that uniquely identifies a row indicator cell
            object o = hi.HitTest.ToString() + hi.RowHandle.ToString();
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("行数据基本信息:");
            foreach (GridColumn gridCol in view.Columns)
            {
                if (!gridCol.Visible)//如果加 ! 表示 被隐藏的列,如果不加,则显示所见的列
                {
                    sb.AppendFormat("{0}:{1}\r\n", gridCol.Caption, view.GetRowCellDisplayText

(hi.RowHandle, gridCol.FieldName));
                }
            }
            info = new ToolTipControlInfo(o, sb.ToString());

            // }

            //Supply tooltip information if applicable, otherwise preserve default tooltip (if any)
            if (info != null)
            {
                e.Info = info;
            }


        }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2021-12-30
  • 2021-11-03
猜你喜欢
  • 2022-12-23
  • 2021-09-03
  • 2022-02-25
  • 2021-08-18
  • 2022-12-23
  • 2021-06-07
  • 2021-04-12
相关资源
相似解决方案