我想知道是否有一种方法可以转换它,以便通过使用 Parallel.For 来提高性能。
public FrameworkElement FindIntersectingElement(Rect rectangle, UIElement activeElement)
{
foreach (var child in this.Children)
{
if (child != activeElement)
{
if (GetBounds(child as FrameworkElement, this).IntersectsWith(rectangle))
{
return child as FrameworkElement;
}
}
}
return null;
}
public Rect GetBounds(FrameworkElement of, FrameworkElement from)
{
GeneralTransform transform = null;
transform = of.TransformToVisual(from);
return transform.TransformBounds(new Rect(0, 0, of.ActualWidth, of.ActualHeight));
}
有什么建议么?