WPF 美化Button按钮
2015-06-25 17:25
471 查看
<Page.Resources> <Style x:Key="ButtonStyle" TargetType="{x:Type Button}"> <Setter Property="Foreground" Value="White"/> <Setter Property="Template"> <Setter.Value> <!--设置样式 --> <ControlTemplate TargetType="{x:Type Button}"> <Grid> <Rectangle x:Name="Rectangle" StrokeMiterLimit="1.000000" StrokeThickness="0.500000" RadiusX="10" RadiusY="10"> </Rectangle> <ContentPresenter x:Name="ContentPresenter" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/> </Grid> <!-- 设置鼠标移到关闭按钮上的效果 --> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="true"> <Setter Property="Fill" TargetName="Rectangle"> <Setter.Value> <SolidColorBrush Color="#c0c0c0"></SolidColorBrush> </Setter.Value> </Setter> <Setter Property="Foreground" Value="Black"></Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </Page.Resources>
<Button Name="yb1" Style="{StaticResource ButtonStyle}" Height="100" Width="100" Margin="2"><Image Source="Image/图形13.png" MouseLeftButtonDown="yb1_Click"></Image></Button>
相关文章推荐
- 数据传输利器--Event Bus模式
- 计算机网络总结(二)
- Codevs1014 装箱问题
- Undefined symbols for architecture arm64解决方案
- 【学习】组合数的递推公式
- LVS负载均衡-使用
- Andorid M来了!
- 国内从事计算机视觉(CV)领域的公司
- JSON字符串转JSON对象,表单固定表头
- 黑马程序员——java基础(一)
- 日语学习之沪江N3基础 20150625 -6
- Http请求Demo
- Npoi导入时:Found EOFRecord before WindowTwoRecord was encountered
- tomcat性能优化参数
- 静态常量(static final)在class文件中是怎样的呢?
- JS-prototype(实例说明)
- 概述FaceRecognizer人脸识别类contrib
- 大型商贸系统(进货管理)技术解析(三)自营进仓冲红单
- 20150625_Andriod_02_ListView2_多条目显示_选中
- centos6中yum安装vnc