在WPF中如何在鼠标悬停时缩放按钮 [英] How to zoom a button while in mouse over in wpf

查看:185
本文介绍了在WPF中如何在鼠标悬停时缩放按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我想在wpf中创建一个圆角按钮.当我将鼠标悬停在按钮上时,图像应放大.
如何在WPF中做到这一点?就像在Google图片中一样.当我们将鼠标放在Google图片中时,图片将被缩放.

任何人都可以在wpf中提供示例.


问候
froxy

Hi All

I want to create a rounded corner button in wpf. And when i mouseover the button the image should be zoomed.
How to do it in wpf? It is like in the google images.When we place the mouse over the image in google, the image will be zoomed.

Can anyone provide the sample in wpf.


Regards
froxy

推荐答案

好,简单版本:
Ok, simple version:
<Viewbox>
    <Viewbox.Style>
        <Style TargetType="Viewbox">
            <Setter Property="Width" Value="150"/>
            <Setter Property="Height" Value="150"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Width" Value="200"/>
                    <Setter Property="Height" Value="200"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Viewbox.Style>
    <Image Source="/WpfApplication6;component/the-angry-programmer.png" />
</Viewbox>


我遇到了同样的问题,并在这里找到了解决方法

尝试或让我知道您的代码

http://stackoverflow.com/questions/1502914/how-do-i-change-an-image-on-hover-over-in-wpf [
I had same problem and found solution here

try or let me know your code

http://stackoverflow.com/questions/1502914/how-do-i-change-an-image-on-hover-over-in-wpf[^]


这篇关于在WPF中如何在鼠标悬停时缩放按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆