问题描述
我的WPF堆栈中的工作,我希望能够得到一个MatrixTransform任何变换。根据该链接,它似乎不是MatrixTransform是一个基类,而是变换类型同级其他。然而,所有普通图形变换应该归结为一个MatrixTransform。有没有这方面的任何快捷方式?也许是这样隐藏的投经营者采取的任何转变为MatrixTransform?
I'm working within the WPF stack, and I'd like to be able to get a MatrixTransform for any Transform. According to the link here, it doesn't seem that MatrixTransform is a base class but rather a sibling to the other Transform types. However, all normal graphics transforms should boil down to a MatrixTransform. Are there any shortcuts for this? Maybe something like hidden cast operators to take any transform to a MatrixTransform?
推荐答案
的基类 TranslateTransform
, MatrixTransform
等是抽象类变换
。
变换
类暴露类型的值
属性矩阵
。在 MatrixTransform
类有一个构造函数一个矩阵
。因此,要获得 MatrixTransform
对应一般到现有的 LayoutTransform
的 FrameworkElement的
你可以用这样的代码:
The Transform
class exposes a Value
property of type Matrix
. The MatrixTransform
class has a constructor that takes a Matrix
. So to get the general MatrixTransform
corresponding to an existing LayoutTransform
of a FrameworkElement
you can use code like this:
var transform = new MatrixTransform(element.LayoutTransform.Value);
这篇关于获得一个MatrixTransform任何变换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!