1
我有下面的代码来调整图像控制为什么在执行RenderTransform后ActualWidth/ActualHeight不会改变?
private void ApplyScale()
{
((CompositeTransform)img.RenderTransform).ScaleX = TotalImageScale;
((CompositeTransform)img.RenderTransform).ScaleY = TotalImageScale;
Debug.WriteLine("img.Width: " + img.Width.ToString() + " - img.ActualWidth: " + img.ActualWidth.ToString());
Debug.WriteLine("img.Height: " + img.Height.ToString() + " - img.ActualHeight: " + img.ActualHeight.ToString());
}
虽然代码工作正常,我试图理解为什么像ActualWidth
和ActualHeight
缩放后不会改变。它们总是与Width
和Height
的值相同。
如何获得新的图像控制尺寸?我是否必须通过比例变化率手动计算?
我明白了。但在Windows Phone 8中没有LayoutTransform? – PutraKg 2013-02-20 07:31:54
@PutraKg对不起,我看到了LayoutTransform和ActualSize,并假设WPF。我对WP8一无所知,但关于RenderTransform的信息仍然是正确的。 – TheEvilPenguin 2013-02-20 09:33:58