我要实现:用Slider滑动来改变图片的缩放。blend 2.5的代码是
<Slider Height="24" HorizontalAlignment="Left" Margin="56,176,0,0" VerticalAlignment="Top" Width="160" Maximum="20" Minimum="1" Value="10" x:Name="SILZoomX" ValueChanged="Zoom_ValueChanged"/>
<Image Margin="0,93,337.626007080078,0" VerticalAlignment="Top" HorizontalAlignment="Right" Source="IMG0087A.jpg" Height="7.436" Width="6.374" RenderTransformOrigin="0.476000010967255,0.513000011444092" d:LayoutOverrides="HorizontalAlignment, Width, Height" x:Name="Photo" >
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="10" ScaleY="10" x:Name="ImageZoom"/>
</TransformGroup>
</Image.RenderTransform>
</Image>
想通过改变ScaleX,ScaleY的值达到缩放图片的效果
VS2008的代码是
private void Zoom_ValueChanged(object sender, RoutedEventArgs e)
{
ImageZoom.ScaleX=SILZoomX.Value;
}
依理说是对的呀。可为什么运行是有“未将对象引用设置到对象的实例。”的错呢?