当将鼠标悬停在网格行上时,工具提示现在正在运行。我需要将其更改为仅在将鼠标悬停在网格的第二列上时执行工具提示。如果我在列上,那么我需要我刚刚盘旋的单元格中的值。似乎无法开始工作。如果我使用:hitInfo.Column.FieldName
,只有在我不使用行信息时才会有效。我需要在这里添加什么?
private void StrGridToolTipController_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e)
{
GridHitInfo hitInfo = gridViewST.CalcHitInfo(e.ControlMousePosition);
if (hitInfo.HitTest == GridHitTest.RowIndicator)
{
Something lc = gridViewST.GetRow(hitInfo.RowHandle) as Something;
//get the cell value to use in rest of the code
//do the tooltip string of data - that is working
答案 0 :(得分:1)
这是我们在为特定列提供工具提示时使用的VB代码....
Dim info As Views.Grid.ViewInfo.GridHitInfo = _gv.CalcHitInfo(e.ControlMousePosition)
If info.InRowCell Then
If info.Column.FieldName = "KPIStatus" Then
...
答案 1 :(得分:0)
您需要检查GridHitInfo.InRowCell
属性的值,并将GridHitInfo.Column
属性的值与ColumnView.VisibleColumns
集合中的第二个值进行比较。要获取单元格的值,您可以使用GridView.GetRowCellValue
方法和GridHitInfo.RowHandle
属性
这是一个例子:
private void StrGridToolTipController_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e)
{
if (e.SelectedControl == gridViewST.GridControl)
{
var info = gridViewST.CalcHitInfo(e.ControlMousePosition);
if (info.InRowCell && info.Column == gridViewST.VisibleColumns[1])
{
object value = gridViewST.GetRowCellValue(info.RowHandle, info.Column);
//do the tooltip string of data
}
}
}