当前位置:网站首页>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
边栏推荐
- TS进阶之条件类型
- Base du Shell - 30, utilisation de la commande sed
- Fuel scheme and product business modeling
- 塔米狗知识|全面剖析国有企业并购含义及其作用
- (small information for children to children-03) batch template production of basic information collection folder for children (including PDF, word and certificate folder)
- 自己炒股怎么开户?安全可靠吗?
- 【TcaplusDB知识库】TcaplusDB表数据缓写介绍
- 2022.2:EyeshotPro EyeshotUltimate EyeshotFem
- Idea usage
- 【TcaplusDB知识库】TcaplusDB-tcapulogmgr工具介绍(一)
猜你喜欢
随机推荐
Performance monster on arm64: installation and performance test of API gateway Apache APIs IX on AWS graviton3
Kubernetes problem sorting
Lightweight real-time semantic segmentation: eNet & erfnet
[tcapulusdb knowledge base] tcapulusdb doc acceptance - Introduction to creating game area
【TcaplusDB知识库】Tmonitor后台一键安装介绍(二)
What is the appropriate setting for the number of database connections?
[tcapulusdb knowledge base] tcapulusdb cluster management introduction
Kubernetes问题整理
fitfi运动赚钱链游系统开发模式详情
【TcaplusDB知识库】TcaplusDB新增机型介绍
MCDF Experiment 2
【TcaplusDB知识库】TcaplusDB-tcapsvrmgr工具介绍(二)
多系统对接的适配与包装模式应用
以梦为马之89c51单片机驱动lcd
[SQL statement basics] - select (supplement to single table query sequence)
【TcaplusDB知识库】TcaplusDB表数据缓写介绍
How camunda uses script script nodes
【TcaplusDB知识库】TcaplusDB机型管理介绍
Audio and video technology development weekly 𞓜 249
【Verilog向SystemVerilog过渡遇到的问题】~ 信号变量类型的转变、 == 和 ===的区别









