- 积分
- 33
- 在线时间
- 53 小时
- 主题
- 28
- 注册时间
- 2013-8-31
- 帖子
- 132
- 最后登录
- 2019-10-21
- 帖子
- 132
- 软币
- 3320
- 在线时间
- 53 小时
- 注册时间
- 2013-8-31
|
using DevExpress.Utils;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
先添加一个ToolTipController控件在GetActiveObjectInfo事件里
private void toolTipController1_GetActiveObjectInfo(object sender, ToolTipControllerGetActiveObjectInfoEventArgs e)
{
if (e.SelectedControl == this.gridControl1)
{
ToolTipControlInfo toolTipControlInfo = null;
GridView gridView = this.gridControl1.GetViewAt(e.ControlMousePosition) as GridView;
if (gridView != null)
{
GridHitInfo gridHitInfo = gridView.CalcHitInfo(e.ControlMousePosition);
if (gridHitInfo.HitTest == GridHitTest.RowIndicator)
{
object @object = gridHitInfo.HitTest.ToString() + gridHitInfo.RowHandle.ToString();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("行数据基本信息:");
foreach (GridColumn gridColumn in gridView.Columns)
{
if (gridColumn.Visible)
{
stringBuilder.AppendFormat(" {0}:{1}\r\n", gridColumn.Caption, gridView.GetRowCellDisplayText(gridHitInfo.RowHandle, gridColumn.FieldName));
}
}
toolTipControlInfo = new ToolTipControlInfo(@object, stringBuilder.ToString());
}
if (toolTipControlInfo != null)
{
e.Info = toolTipControlInfo;
}
}
}
}
|
评分
-
查看全部评分
|