WPF Button TextBox 圆角
<!--圆角button-->
<Style TargetType="Button">
<Setter Property="FontSize" Value="15"/>
<Setter Property="Margin" Value="4"/>
<Setter Property="FontWeight" Value="Black"/>
<Setter Property="Foreground" Value="WhiteSmoke"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="#FFFF4300"/>
<Setter Property="Width" Value="100"/>
<Setter Property="Height" Value="35"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="16" Name="PART_Background">
<Border.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="White" Offset="0.0" />
<GradientStop Color="#FFFF4300" Offset="0.5" />
<GradientStop Color="White" Offset="0.0" />
</LinearGradientBrush>
</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
TextBox圆角
<Style TargetType="{x:Type TextBox}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="6"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="BorderBrush">
<Setter.Value>
<LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
<GradientStop Color="OrangeRed" Offset="0"/>
<GradientStop Color="#FFFFCB97" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Grid>
<Rectangle RadiusX="5" RadiusY="5" Fill="{TemplateBinding Background}" Stroke="OrangeRed" StrokeThickness="2"/>
<ScrollViewer x:Name="PART_ContentHost"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden"
Padding="{TemplateBinding Padding}"
Focusable="false">
</ScrollViewer>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
WPF Button TextBox 圆角的更多相关文章
- WPF textbox 圆角制作
在app.xaml中加入以下节点,全局设置textbox圆角 <Style TargetType="{x:Type TextBox}"> < ...
- WPF的TextBox产生内存泄露的情况
前段时间参与了一个WPF编写的项目,在该项目中有这样一个场景:在程序运行过程中需要动态地产生大量文本信息,并追加WPF界面上的一个TextBox的Text中进行显示.编写完之后,运行该项目的程序,发现 ...
- WPF自定义TextBox及ScrollViewer
原文:WPF自定义TextBox及ScrollViewer 寒假过完,在家真心什么都做不了,可能年龄大了,再想以前那样能专心坐下来已经不行了.回来第一件事就是改了项目的一个bug,最近又新增了一个新的 ...
- WPF button 如何区分click和doubleclick
WPF button 同时处理两个事件时候会先触发click事件,触发doubleclick事件 ,那如何区分呢,可以这样设置: private static DispatcherTimer myC ...
- WPF Button的背景图片设置
这个问题很简单,但是对于从winfrom转过来的来讲,在做事的时候就会被绕进去,言归正传,如何设置一个bUtton的背景图片?如何去掉让人烦的默认选中时的灰色背景?请看如下的描述.问题的来源和解决都在 ...
- Wpf解决TextBox文件拖入问题、拖放问题
在WPF中,当我们尝试向TextBox中拖放文件,从而获取其路径时,往往无法成功(拖放文字可以成功).造成这种原因关键是WPF的TextBox对拖放事件处理机制的不同, 解放方法如下: 使用Previ ...
- WPF中TextBox文件拖放问题
在WPF中,当我们尝试向TextBox中拖放文件,从而获取其路径时,往往无法成功(拖放文字可以成功).造成这种原因关键是WPF的TextBox对拖放事件处理机制的不同,具体可参考这篇文章Textbox ...
- UWP Button添加圆角阴影(三)
原文:UWP Button添加圆角阴影(三) Composition DropShadow是CompositionAPI中的东西,使用Storyboard设置某个属性,就是频繁的触发put_xxx() ...
- UWP Button添加圆角阴影(二)
原文:UWP Button添加圆角阴影(二) 阴影 对于阴影呢,WindowsCommunityToolkit中已经有封装好的DropShadowPanel啦,只要引用Microsoft.Toolki ...
随机推荐
- Springboot集成BeanValidation扩展二:加载jar中的资源文件
一.需求 今天在搭建Springboot框架的时候,又遇到一个需求:在多模块系统中,有些模块想自己管理BeanValidation的资源文件(默认是启动项目claspath下的 ValidationM ...
- 【spring mvc】后台API查询接口,get请求,后台Date字段接收前台String类型的时间,报错default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'createDate';
后台API查询接口,get请求,后台Date字段接收前台String类型的时间筛选条件 后台接口接收 使用的实体 而createDate字段在后台实体中是Date类型 报错信息: org.spring ...
- 如何评价 GitHub 发布的文本编辑器 Atom?
这里是HN上的讨论:GitHub's new text editor leaked on Twitter这里是github page:Atom · GitHub 好多repo啊我不知道有没有知友了解更 ...
- 【TCP/IP】IP路由选择
IP层在内存中有一个路由表,当有数据要发送时.它要对该表进行一次搜索以确认转发地址.收到的数据到达IP层时,IP层会检查数据报的目的地址是否为本机IP或广播IP: 假设是.就依据IP首部协议字段的协议 ...
- 安装dcm4chee-arc-light-5.4.1-mysql步骤
一.进入网址: https://github.com/dcm4che/dcm4chee-arc-light/wiki/Installation 这个是GitHub上面给的步骤,可能会比较难理解,按照所 ...
- 【AS3 Coder】任务五:Flash 2D游戏的第二春(下)
在上一节中,我们基本上已经讲完了游戏中最主要的逻辑部分,不过为了更加全面地运用Starling中的一些特性,在本节中我们将一起来看看如何实现多面板切换以及粒子效果,这两个玩意儿可是比较频繁会出现于St ...
- wget jdk
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-co ...
- JPEG编码(一)
JPEG编码介绍. 转自:http://blog.chinaunix.net/uid-20451980-id-1945156.html JPEG(Joint Photographic Experts ...
- javascript event loop
原文: https://blog.csdn.net/sjn0503/article/details/76087631 简单来讲,整体的js代码这个macrotask先执行,同步代码执行完后有micro ...
- jsp中URL传递中文參数的处理
在页面的url中使用encodeURI(encodeURI(中文)).对中文进行编码.并在server的java程序中使用URLDecoder.decode(中文, "UTF-8" ...