Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics
Private Sub ultraGrid1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ultraGrid1.Click
Dim mainElement As UIElement
Dim element As UIElement
Dim screenPoint As Point
Dim clientPoint As Point
Dim row As UltraGridRow
Dim cell As UltraGridCell
' コントロールのメイン要素を取得します
mainElement = Me.ultraGrid1.DisplayLayout.UIElement
' 現在のマウス位置をコントロールのクライアント座標
' のポイントに変換します
screenPoint = Control.MousePosition
clientPoint = Me.ultraGrid1.PointToClient(screenPoint)
' そのポイントにある要素を取得します
element = mainElement.ElementFromPoint(clientPoint)
If element Is Nothing Then Return
Debug.WriteLine("Clicked on an " + element.GetType().ToString())
Debug.Indent()
' この要素を含む行を取得します
row = element.GetContext(GetType(UltraGridRow))
If Not row Is Nothing Then
Debug.WriteLine("in row: " + row.Index.ToString())
' この要素を含むセルを取得します
cell = element.GetContext(GetType(UltraGridCell))
If Not cell Is Nothing Then
Debug.WriteLine("in column: " + cell.Column.Key)
Debug.WriteLine("cell text: " + cell.Text)
End If
End If
' 親要素 チェーンをたどり、各親要素について
' 1 行ずつ情報を出力します
While Not element.Parent Is Nothing
element = element.Parent
Debug.WriteLine("is a child of an " + element.GetType().ToString())
Debug.Indent()
End While
' インデント レベルをリセットします
Debug.IndentLevel = 0
End Sub