当前位置:网站首页>14. Notes on using border decorator of WPF
14. Notes on using border decorator of WPF
2022-06-13 11:47:00 【komla168】
One 、 brief introduction
Border Is a decorator control , Use to draw a border or background around another element .

Border Can only contain one control , If you want to include multiple controls, you need to add a layer in the middle , Give Way Border To include a layout control , The layout control contains other controls .
Two 、 Common properties
Since it's a decorator , Is to do some operations around the contained controls , There are several commonly used : Border color 、 The thickness of the 、 Border background , these Attributes are generally used together .
2.1 Border color and thickness (BorderBrush/BorderThickness)
The default border thickness is 0, So you can't see any effect by setting the border color alone , You need to set the border thickness to see .
<Grid Margin="10">
<Border BorderBrush="Red" BorderThickness="2">
<StackPanel Margin="10">
<Button Content="fengtun"/>
<Button Content="jioabi"/>
<Button Content="yanggaoxiong"/>
</StackPanel>
</Border>
</Grid>
This border thickness value can be set in the up, down, left and right directions respectively
<Grid Margin="10">
<Border BorderBrush="Red" BorderThickness="1 5 10 20">
<StackPanel Margin="10">
<Button Content="engtun"/>
<Button Content="jioabi"/>
<Button Content="anggaoxiong"/>
</StackPanel>
</Border>
</Grid>
2.2 Round corners (CornerRadius)
Set up Border The degree of rounding of the corners , The same can be set separately 4 Values for angles
<Border BorderBrush="Red" BorderThickness="1 5 10 20" CornerRadius="1,5,10,20">
<StackPanel Margin="10">
<Button Content="engtun"/>
<Button Content="jioabi"/>
<Button Content="anggaoxiong"/>
</StackPanel>
</Border>
2.3 Border background (Background)
Background Attribute belongs to Brush type , So the operability is very strong , Handle using simple colors beyond , You can also use gradients as backgrounds .
<Grid Margin="10">
<Border BorderBrush="Red" BorderThickness="1 5 10 20" CornerRadius="1,5,10,20">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#1ca6ff" Offset="0.5"/>
<GradientStop Color="#f8024e" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<StackPanel Margin="10">
<Button Content="engtun"/>
<Button Content="jioabi"/>
<Button Content="anggaoxiong"/>
</StackPanel>
</Border>
</Grid>
3、 ... and 、 Citations
3.1 WPF - Essay classification - microsoft-zhcn - Blog Garden
边栏推荐
- Process of manually encrypting and burning the mass production firmware of ESP equipment
- 【Verilog向SystemVerilog过渡遇到的问题】~ 信号变量类型的转变、 == 和 ===的区别
- Query the current number of computer CPU cores
- Adaptation of multi system docking and application of packaging mode
- 7.5.4:Spire Office for .NET New Version
- MFC custom button to realize color control
- It's the first time that the programmer interview pays so much attention to the concept of investigation
- 【TcaplusDB知识库】Tmonitor系统升级介绍
- Discord机器人开发
- C#/VB. Net to generate directory bookmarks when word is converted to PDF
猜你喜欢

【TcaplusDB知识库】TcaplusDB-tcapulogmgr工具介绍(二)

Meta universe land: what makes digital real estate valuable

关于 SAP Spartacus CmsService.getComponentData 可能的优化思路

产品故事|你所不知道的语雀画板

About SAP Spartacus cmsservice Possible optimization ideas for getcomponentdata

【福利】,分分钟搞定

我是如何解决码云图床失效问题?

Discord机器人开发

MCDF Experiment 2

秒云与趋动科技联合发布容器云平台与GPU资源池化整体解决方案
随机推荐
C#/VB.NET 在Word转PDF时生成目录书签
书籍+视频+学习笔记+技能提升资源库,面试必问
Kubernetes problem sorting
CPU的分支预测
22. Class E power amplifier design of ads usage record (Part 2)
Similarities and differences between commonAPI and AUTOSAR AP communication management
Model building process 1==miidock
Web 3.0? High cost version of P2P
web开发视频教程,web开发教学
How to open an account for your own stock trading? Is it safe and reliable?
What is the appropriate setting for the number of database connections?
【TcaplusDB知识库】TcaplusDB分析型文本导出介绍
Apache apisik v2.14.1 exploratory release to expand into more fields
17 pictures: read and understand the first domestic guide for mainframe security capacity building
数据库连接数设置多少合适?
[tcapulusdb knowledge base] tcapulusdb Model Management Introduction
关于 SAP Spartacus CmsService.getComponentData 可能的优化思路
MIIdock文件分布
C#/VB. Net to generate directory bookmarks when word is converted to PDF
(幼升小信息-04)如何用手机WPS在PDF上进行电子签名