首页 > Windows开发 > 详细

图片放大器——wpf

时间:2015-06-27 23:59:52      阅读:392      评论:0      收藏:0      [点我收藏+]

<Grid>
                        <Image x:Name="imgSource" Source="{Binding WebPath}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40">
                            <!--Tag="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DataContext}" -->
                            <!--<Image.RenderTransform>
                                <ScaleTransform x:Name="scaleTrans" CenterX="20" CenterY="20"/>
                            </Image.RenderTransform>-->
                           
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="MouseEnter">
                                    <i:InvokeCommandAction Command="{Binding MouseEnterFeedFileCommand}" CommandParameter="{Binding}"/>
                                </i:EventTrigger>
                                <i:EventTrigger EventName="MouseLeave">
                                    <i:InvokeCommandAction Command="{Binding MouseLeaveFeedFileCommand}" CommandParameter="{Binding}"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Image>
                    </Grid>

 

private void MouseEnterFeedFile(object obj) {     if (MouseEnterFeedFileEvent != null)     {         MouseEnterFeedFileEvent(this);     }

    //ScaleTransform scaleTrans = new ScaleTransform { CenterX = 20, CenterY = 20 };     //Image img = obj as Image;     //if (img != null)     //{             //    Panel.SetZIndex(img, 9);     //    img.RenderTransform = scaleTrans;     //    scaleTrans.ScaleX += 5;     //    scaleTrans.ScaleY += 5;     //} }

 

private void MouseLeaveFeedFile(object obj)
{
    if (MouseLeaveFeedFileEvent != null)
    {
        MouseLeaveFeedFileEvent(this);
    }
    //Image img = obj as Image;
    //if (img != null)
    //{
    //    Panel.SetZIndex(img, 0);
    //    ScaleTransform scaleTrans = img.RenderTransform as ScaleTransform;
    //    if (scaleTrans != null)
    //    {
    //        scaleTrans.ScaleX -= 5;
    //        scaleTrans.ScaleY -= 5;
    //    }
    //}
}

 

图片放大器——wpf

原文:http://www.cnblogs.com/changbaishan/p/4604840.html

(1)
(1)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!