码迷,mamicode.com
首页 > Windows程序 > 详细

图片放大器——wpf

时间:2015-06-28 00:00:20      阅读:320      评论: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!