夜光上的MouseEnter WPF影响 [英] Glow effect on MouseEnter WPF

查看:328
本文介绍了夜光上的MouseEnter WPF影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WPF(C#)是新。我需要使用使周围的图像控制发光效果触发。我该怎么办就鼠标输入事件光晕效果?
我想用你的答案我我的风格。

I'm new in WPF(c#). I need make a glow effect around image control using triggers. How can I do make glow effect on mouse-enter event? I want to use your answer i my style.

我的效果是:

<DropShadowEffect x:Key="MyEffect" ShadowDepth="0" Color="Blue" Opacity="1" BlurRadius="20"/>



我看到许多联系,但他们没有工作。

I see many links but they don't work.

推荐答案

要添加辉光图片控制你需要设置效果你的 DropShadowEffect IsMouseOver = TRUE ,是这样的:

To add glow to Image control you need to set Effect to your DropShadowEffect when IsMouseOver=True, something like this:

<Image Source="/WpfApplication1;component/myimage.png">
   <Image.Style>
      <Style TargetType="{x:Type Image}">
         <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
               <Setter Property="Effect">
                  <Setter.Value>
                     <DropShadowEffect ShadowDepth="0" Color="Blue" Opacity="1" BlurRadius="20"/>
                  </Setter.Value>
               </Setter>
            </Trigger>
         </Style.Triggers>
      </Style>
   </Image.Style>
</Image>

这篇关于夜光上的MouseEnter WPF影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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