'宣言 Public Overloads Function HasContext( _ ByVal context As Object, _ ByVal checkParentElementContexts As Boolean _ ) As Boolean
public bool HasContext( object context, bool checkParentElementContexts )
Imports System.Windows.Forms Imports Infragistics.Win Imports System.Diagnostics Private Sub UltraGrid1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles UltraGrid1.MouseMove If IsPointOverUltraGridActiveRow(New Point(e.X, e.Y)) Then Debug.WriteLine("Over Active Row") Else Debug.WriteLine("Not Over Active Row") End If End Sub Private Function IsPointOverUltraGridActiveRow(ByVal pt As Point) As Boolean Dim hitElement As UIElement = Me.UltraGrid1.DisplayLayout.UIElement.ElementFromPoint(pt) If hitElement.HasContext(Me.UltraGrid1.DisplayLayout.ActiveRow) Then Return True Else Return False End If End Function
using System.Windows.Forms using Infragistics.Win using System.Diagnostics private void ultraGrid1_MouseMove(object sender, MouseEventArgs e) { if(IsPointOverUltraGridActiveRow(new Point(e.X,e.Y))) Debug.WriteLine("Over Active Row"); else Debug.WriteLine("Not Over Active Row"); } private bool IsPointOverUltraGridActiveRow(Point pt) { UIElement hitElement = this.ultraGrid1.DisplayLayout.UIElement.ElementFromPoint(pt); if(hitElement.HasContext(this.ultraGrid1.DisplayLayout.ActiveRow)) return true; else return false; }