Brush 类提供两个

Transform 和 RelativeTransform 属性之间的区别

当转换应用到画笔的Transform属性,则需要知道绘制区域的大小,如果你想要转换画笔内容围绕其中心。 假设已绘制区域的宽度为 200 个与设备无关的像素,高度为 150。 如果您使用了RotateTransform旋转画笔的输出围绕其中心的 45 度,您将为RotateTransformCenterX为 100 和CenterY的 75。

当转换应用到画笔的RelativeTransform属性,该转换应用到画笔输出映射到已绘制区域之前。 以下列表介绍处理和转换画笔内容的顺序。

  1. 处理画笔的内容。 有关GradientBrush,这意味着确定渐变区域。 有关TileBrush,则Viewbox映射到Viewport。 这成为画笔的输出。

  2. 将画笔的输出投影到 1 x 1 的转换矩形上。

  3. 应用画笔的RelativeTransform,如果有的话。

  4. 将转换后的输出投影到要绘制的区域上。

  5. 应用画笔的Transform,如果有的话。

因为RelativeTransform画笔的输出映射到 1 x 1 的矩形,转换中心和偏移的值看起来是相对时应用。

转换属性:TransformRelativeTransform。 使用这些属性,可以旋转、缩放、倾斜和转换画笔的内容。

WPF Transform

相关文章:

  • 2021-11-22
  • 2022-12-23
  • 2021-12-22
  • 2021-09-06
  • 2022-01-17
  • 2022-01-01
猜你喜欢
  • 2022-12-23
  • 2021-06-17
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案