本文整理汇总了C#中System.Windows.Automation.Provider.IRawElementProviderFragmentRoot.ElementProviderFromPoint方法的典型用法代码示例。如果您正苦于以下问题:C# IRawElementProviderFragmentRoot.ElementProviderFromPoint方法的具体用法?C# IRawElementProviderFragmentRoot.ElementProviderFromPoint怎么用?C# IRawElementProviderFragmentRoot.ElementProviderFromPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了IRawElementProviderFragmentRoot.ElementProviderFromPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MyDelegate
delegate Rectangle MyDelegate(Rectangle clientRect);
/// <summary>
/// Gets the child element that is at the specified point.
/// </summary>
/// <param name="x">Distance from the left of the application window.</param>
/// <param name="y">Distance from the top of the application window.</param>
/// <returns>The provider for the element at that point.</returns>
IRawElementProviderFragment IRawElementProviderFragmentRoot.ElementProviderFromPoint(
double x, double y)
{
// The RectangleToScreen method on the control can't be called directly from
// this thread, so use delegation.
MyDelegate del = new MyDelegate(this.RectangleToScreen);
Rectangle screenRectangle = (Rectangle)this.Invoke(del, new object[] { this.DisplayRectangle });
if (screenRectangle.Contains((int)x, (int)y))
{
int index = (int)(((int)(y - screenRectangle.Y)) / itemHeight);
if (index < myItems.Count)
{
return (IRawElementProviderFragment)myItems[index];
}
else
{
return (IRawElementProviderFragment)this;
}
}
else
{
return null;
}
}
开发者ID:.NET开发者,项目名称:System.Windows.Automation.Provider,代码行数:33,代码来源:IRawElementProviderFragmentRoot.ElementProviderFromPoint