< wpf question>如何删除按钮发光效果和边框 [英] <wpf question> how to remove the button glow effect and border

查看:76
本文介绍了< wpf question>如何删除按钮发光效果和边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,有人可以用wpf按钮帮我吗

我想删除边框和按钮发光效果。

我的按钮有图像背景,它会改变时鼠标悬停但按钮发光。



这里是按钮代码,我正在使用visual studio 2010



 <  按钮      Grid.Row   =  1   高度  =  214    Horizo​​ntalAlignment   =     Marg in   =  92,10,0,0   名称  =  Inv     VerticalAlignment   = < span class =code-keyword> Top   宽度  =  279    BorderBrush   =  {x:Null}   前景  =  {x:Null }   点击  = <跨度class =code-keyword> Inv_Click    Grid.RowSpan   =  2    BorderThickness   =  0    ClickMode   =  < span class =code-attribute>  可聚焦  =  False   >  
< Button.Style >
< 样式 TargetType = {x:Type Button} >
< Setter Property = 背景 >
< Setter.Value >
< ImageBrush ImageSource = / ManaData; component / Images / Inv.png / >
< / Setter.Value >
< / Setter >
< Style.Triggers >
< ; 触发器 属性 < span class =code-keyword> = IsMouseOver = True >
< Setter 属性 = 背景 >
< Setter.Value >
< ImageBrush ImageSource = /ManaData ;component/Images/Inv2.png / >
< / Setter.Value >
< / Setter >
< / Trigger >
< / Style.Triggers >
< / Style >
< / Button.Style >
< < span class =code-leadattribute> / Button >

解决方案

你可以用sim ply将默认边框画笔覆盖到您自己的边框画笔



 <   style.triggers  >  
< 触发器 property = IsMouseOver value = true >
< setter property = BorderBrush value = {StaticResource ToYourBorder} > < / setter >
< / trigger >
< / style.triggers >


Hello everyone, can someone help me with wpf button
I want to remove the border and button glow effect.
my button has an image background, it changes when the mouse hover but the button glows.

here is the button code, I'm using visual studio 2010

<Button  Grid.Row="1" Height="214" HorizontalAlignment="Left" Margin="92,10,0,0" Name="Inv" VerticalAlignment="Top" Width="279" BorderBrush="{x:Null}" Foreground="{x:Null}" Click="Inv_Click" Grid.RowSpan="2" BorderThickness="0" ClickMode="Press" Focusable="False" >
            <Button.Style>
                <Style TargetType="{x:Type Button}">
                    <Setter Property="Background">
                        <Setter.Value>
                            <ImageBrush ImageSource="/ManaData;component/Images/Inv.png"/>
                        </Setter.Value>
                    </Setter>
                    <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <ImageBrush ImageSource="/ManaData;component/Images/Inv2.png"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Button.Style>
        </Button>

解决方案

you can simply override the default border brush to your own border brush

<style.triggers>
    <trigger property="IsMouseOver" value="true">
        <setter property="BorderBrush" value="{StaticResource ToYourBorder}"></setter>
    </trigger>
  </style.triggers>


这篇关于&lt; wpf question&gt;如何删除按钮发光效果和边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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