1.拖入一个ToolTipController控件,和一个GridControl控件
2.设置GridControl中的GridView的中的属性ToolTipController为刚刚拖入的ToolTipController
3.给ToolTipController控件添加GetActiveObjectInfo事件
if (e.SelectedControl != UserGrid) return; ToolTipControlInfo info = null; GridView view = UserGrid.GetViewAt(e.ControlMousePosition) as GridView; if (view == null) return; GridHitInfo hi = view.CalcHitInfo(e.ControlMousePosition); if (hi.HitTest == GridHitTest.RowIndicator) { Object o = hi.HitTest.ToString() + hi.RowHandle.ToString(); StringBuilder sb = new StringBuilder(); sb.AppendLine("基本信息"); foreach (GridColumn col in view.Columns) { if (col.Visible) { sb.AppendFormat("{0}:{1} ",col.Caption,view.GetRowCellDisplayText(hi.RowHandle,col.FieldName)); } } info = new ToolTipControlInfo(o,sb.ToString()); } if (info != null) { e.Info = info; }
4.完成了