-
Notifications
You must be signed in to change notification settings - Fork 0
/
ToolTipHelper.cs
55 lines (54 loc) · 2.15 KB
/
ToolTipHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using DevExpress.Data;
using DevExpress.Utils;
using DevExpress.XtraGrid;
using Q354185.MyXtraGrid;
using System;
using System.Collections.Generic;
using System.Linq;
namespace MultiGroupSummary {
public class ToolTipHelper {
private MyGridControl gridCtrl;
public ToolTipHelper(MyGridControl myGridControl1) {
Init(myGridControl1);
}
private void Init(MyGridControl gridControl) {
gridCtrl = gridControl;
var toolTipController = new ToolTipController();
gridCtrl.ToolTipController = toolTipController;
toolTipController.GetActiveObjectInfo += new ToolTipControllerGetActiveObjectInfoEventHandler(ToolTipController_GetActiveObjectInfo);
}
private void ToolTipController_GetActiveObjectInfo(object sender, ToolTipControllerGetActiveObjectInfoEventArgs e) {
ToolTipControlInfo info = null;
var view = gridCtrl.GetViewAt(e.ControlMousePosition) as MyGridView;
if (view == null) {
return;
}
var hitInfo = view.CalcHitInfo(e.ControlMousePosition);
if (hitInfo == null) {
return;
}
var hitInfoFooterCell = hitInfo.FooterCell;
if (hitInfoFooterCell != null) {
var summaryItem = new GridGroupSummaryItem();
var tag = hitInfoFooterCell.ColumnInfo.Tag as GridGroupSummaryItem;
if (tag != null) {
summaryItem = tag;
} else {
var rowSummaryItem = view.GetRowSummaryItem(hitInfo.RowHandle, hitInfoFooterCell.Column);
summaryItem = rowSummaryItem.Key as GridGroupSummaryItem;
}
if (summaryItem == null) {
return;
}
if (summaryItem.SummaryType == SummaryItemType.None) {
return;
}
info = new ToolTipControlInfo(hitInfoFooterCell.Value, hitInfoFooterCell.DisplayText);
}
if (info == null) {
return;
}
e.Info = info;
}
}
}