关于WPF的圆角
2024-09-08 18:41:25
失败案例
<Border CornerRadius="3" Width="100" Height="100">
<StackPanel Background="Red"></StackPanel>
</Border>
换成下面就成功?为什么?
<Border CornerRadius="3" Background="Red" Width="100" Height="100">
<StackPanel ></StackPanel>
</Border>
1设备Button圆角
<Button x:Name="but1" Content="软件介绍" HorizontalAlignment="Left" Margin="126,356,0,0" VerticalAlignment="Top" Width="128" Click="Button_Click" FontSize="20" Height="35" >
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="10">
<Border.Background>#FF8EB4D4</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Button.Template>
</Button>
2 设置TextBox圆角
<TextBox HorizontalAlignment="Left" Height="24" Margin="43,192,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="98">
<TextBox.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="BorderBrush" Value="#c1d0dc"/>
</Style>
</TextBox.Resources>
</TextBox>
3PasswordBox设置圆角
<PasswordBox x:Name="t2" HorizontalAlignment="Left" Margin="183,150,0,0" VerticalAlignment="Top" Width="114" Height="26" BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" FontSize="18" Password=" ">
<PasswordBox.Resources>
<Style TargetType="PasswordBox">
<Setter Property="PasswordChar" Value="●"/>
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="AllowDrop" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="PasswordBox">
<Border CornerRadius="8" x:Name="Bd" Background="White" BorderBrush="#c1d0dc" BorderThickness="1" OpacityMask="{x:Null}">
<ScrollViewer SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" x:Name="PART_ContentHost" Template="{DynamicResource ScrollViewerControlTemplate1}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</PasswordBox.Resources>
</PasswordBox>
最新文章
- Rectangle Area
- NopCommerce Url分析
- Design and Analysis of Algorithms_Introduction
- 测试bug级别定义
- 在数据库查询时解决大量in 关键字的方法
- 清空系统日志shell scripts——自学笔记
- struts2 标签的使用之一 s:if
- css布局模型之绝对定位与相对定位
- ASP.NET MVC- VIEW Creating Custom HTML Helpers Part 2
- QT开发pjsip的VOIP,A8平台运行
- IO流基础
- Servlet(一)基础总结
- IdentityServer4 禁用 Consent screen page(权限确认页面)
- 学习sharding-jdbc 分库分表扩展框架
- Python多版本共存(生产环境)
- mac 电脑进入root用户
- 实现 js 数据类型的判断函数type
- [Canvas]空战游戏 已经可以玩了 1.13Playable
- Creating a Hadoop-2.x project in Eclipse
- 图解中序遍历线索化二叉树,中序线索二叉树遍历,C\C++描述
热门文章
- HTML5 + canvas 汽车赛道,飙车游戏(附源码)
- 多重背包问题 II
- 学习Java Day21
- Spring IOC官方文档学习笔记(十一)之使用JSR 330标准注解
- quasar打包时:Module not found: Can&#39;t resolve imported dependency ";dayjs/plugin/customParseFormat";
- 挖矿僵尸网络蠕虫病毒kdevtmpfsi处理过程
- 关于vux-ui框架的scroller组件所踩的坑
- CF1141F2 Same Sum Blocks (Hard)
- 找素数(java)
- 吐血整理!2万字Java基础面试题(带答案)请收好!