你好,设置 PictureBox 的 SizeMode 属性为AutoSize就可以自适应的大小了。。。
另外,PictureBox 控件可以直接加载网络的,例如:
pictureBox1ImageLocation = @"";就可以直接加载网络了哦。
用动画实现就好了,代码如下<Grid>
<GridResources>
<Style TargetType="Image">
<Setter Property="LayoutTransform">
<SetterValue>
<ScaleTransform></ScaleTransform>
</SetterValue>
</Setter>
<StyleTriggers>
<EventTrigger RoutedEvent="ImageMouseEnter">
<EventTriggerActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation StoryboardTargetProperty="LayoutTransformScaleX" To="15" Duration="0:0:025"></DoubleAnimation>
<DoubleAnimation StoryboardTargetProperty="LayoutTransformScaleY" To="15" Duration="0:0:025"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTriggerActions>
</EventTrigger>
<EventTrigger RoutedEvent="ImageMouseLeave">
<EventTriggerActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation StoryboardTargetProperty="LayoutTransformScaleX" To="1" Duration="0:0:025"></DoubleAnimation>
<DoubleAnimation StoryboardTargetProperty="LayoutTransformScaleY" To="1" Duration="0:0:025"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTriggerActions>
</EventTrigger>
</StyleTriggers>
</Style>
</GridResources>
<Image Source="npng " Height="40" Width="30">
</Image>
</Grid>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)