【问题标题】:Get updated polygon points after transformation变换后获取更新的多边形点
【发布时间】:2014-11-04 20:32:56
【问题描述】:

我需要在 RotateTransform 之后检索我的多边形(在画布内)的新点坐标。

RotateTransform rotation = new RotateTransform(rotationAngle);
polygon.RenderTransform = rotation;

在应用 RenderTransform 时,polygon.Points 集合不会获得新值。

我读到有人试图绑定这个PointCollection(不是ObservableCollection),但我没有发现任何有用的东西。

【问题讨论】:

    标签: c# wpf transform polygon shapes


    【解决方案1】:

    您可以通过对 Polygon 的 Points 集合中的所有点依次应用变换来获得变换后的点:

    using System.Linq;
    
    var transformedPoints = polygon.Points.Select(p => rotation.Transform(p));
    

    【讨论】:

      猜你喜欢
      • 2017-03-22
      • 1970-01-01
      • 2011-07-03
      • 1970-01-01
      • 2017-07-19
      • 2013-10-03
      • 1970-01-01
      • 2020-02-11
      • 1970-01-01
      相关资源
      最近更新 更多