I've been messing around with the tra开发者_如何学Pythonnsforms option in WPF. How can I "add" a new transform to the existing one? I need to perform several different scalings from several different points at unknowable different times and simply add them on to the existing object, rather than re-creating a new transform with just the new scale in it. I've been trying, for example, RenderTransform.Value.ScaleAt(stuff), but nothing seems to happen. I'm in C#.
Thanks.
The ScaleAt works on a Matrix struct (i.e. the Transform.Value property) and will not be reflected on the actual Transform. What you could do is get the current Matrix, scale it, then apply the new Matrix as a MatrixTransform on the element. Something like this:
Transform t = myObject.RenderTransform;
Matrix m = t.Value;
m.ScaleAt(1.1, 1.1, 0, 0);
myObject.RenderTransform = new MatrixTransform(m);
精彩评论