/
ToolTipHelper.vb
55 lines (54 loc) · 2.25 KB
/
ToolTipHelper.vb
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
Imports DevExpress.Data
Imports DevExpress.Utils
Imports DevExpress.XtraGrid
Imports Q354185.MyXtraGrid
Imports System
Imports System.Collections.Generic
Imports System.Linq
Namespace MultiGroupSummary
Public Class ToolTipHelper
Private gridCtrl As MyGridControl
Public Sub New(ByVal myGridControl1 As MyGridControl)
Init(myGridControl1)
End Sub
Private Sub Init(ByVal gridControl As MyGridControl)
gridCtrl = gridControl
Dim toolTipController = New ToolTipController()
gridCtrl.ToolTipController = toolTipController
AddHandler toolTipController.GetActiveObjectInfo, AddressOf ToolTipController_GetActiveObjectInfo
End Sub
Private Sub ToolTipController_GetActiveObjectInfo(ByVal sender As Object, ByVal e As ToolTipControllerGetActiveObjectInfoEventArgs)
Dim info As ToolTipControlInfo = Nothing
Dim view = TryCast(gridCtrl.GetViewAt(e.ControlMousePosition), MyGridView)
If view Is Nothing Then
Return
End If
Dim hitInfo = view.CalcHitInfo(e.ControlMousePosition)
If hitInfo Is Nothing Then
Return
End If
Dim hitInfoFooterCell = hitInfo.FooterCell
If hitInfoFooterCell IsNot Nothing Then
Dim summaryItem = New GridGroupSummaryItem()
Dim tag = TryCast(hitInfoFooterCell.ColumnInfo.Tag, GridGroupSummaryItem)
If tag IsNot Nothing Then
summaryItem = tag
Else
Dim rowSummaryItem = view.GetRowSummaryItem(hitInfo.RowHandle, hitInfoFooterCell.Column)
summaryItem = TryCast(rowSummaryItem.Key, GridGroupSummaryItem)
End If
If summaryItem Is Nothing Then
Return
End If
If summaryItem.SummaryType = SummaryItemType.None Then
Return
End If
info = New ToolTipControlInfo(hitInfoFooterCell.Value, hitInfoFooterCell.DisplayText)
End If
If info Is Nothing Then
Return
End If
e.Info = info
End Sub
End Class
End Namespace