我正在尝试弄清楚画布上多个选定对象的缩放算法(类似于Visio的行为)。例如,我在我的应用程序中选择了以下对象:
然后,我拖动边界框的右下角手柄以增加所选对象的大小,从而产生以下结果:
我的问题如下:
- 如何获得要应用于每个对象的缩放量?
- 如何获得要应用于每个对象的平移量?
ScaleTransform scale = new ScaleTransform();
//_text is the scaled object
scale.ScaleX = text.ActualWidth - _width; //_width is width of the textbox at beginning.
scale.ScaleY = text.ActualHeight - _height; //_height is the height of textbox at the beginning.