コード例 #1
0
ファイル: Element.cs プロジェクト: MichaelBergerman/TestR
 /// <summary>
 /// Gets the element that is currently at the point.
 /// </summary>
 /// <param name="point"> The point to try and detect at element at. </param>
 /// <returns> The element if found or null if not found. </returns>
 public static Element FromPoint(Point point)
 {
     try
     {
         var automation = new CUIAutomationClass();
         var element    = automation.ElementFromPoint(new tagPOINT {
             x = point.X, y = point.Y
         });
         return(element == null ? null : new Element(element, null, null));
     }
     catch (Exception)
     {
         return(null);
     }
 }
コード例 #2
0
ファイル: DesktopElement.cs プロジェクト: BobbyCannon/TestR
 /// <summary>
 /// Gets the element that is currently at the point.
 /// </summary>
 /// <param name="point"> The point to try and detect at element at. </param>
 /// <returns> The element if found or null if not found. </returns>
 public static DesktopElement FromPoint(Point point)
 {
     try
     {
         var automation = new CUIAutomationClass();
         var element = automation.ElementFromPoint(new tagPOINT { x = point.X, y = point.Y });
         return element == null ? null : new DesktopElement(element, null, null);
     }
     catch (Exception)
     {
         return null;
     }
 }