WPF Border控件 基本使用

Border 基本使用

1单线效果

代码:

复制代码
<Border Grid.Row="0" BorderThickness="0,0,0,1" BorderBrush="Red" />

说明:

复制代码
BorderThickness="0,0,0,1" 可以分别设置四条边,顺序是:左 上 右 下
复制代码
2虚线效果

代码:

复制代码
<Border Grid.Row="0" BorderThickness="0,0,0,1" >
      <Border.BorderBrush>
          <VisualBrush>
              <VisualBrush.Visual>
                  <Rectangle StrokeDashArray="4 2" Stroke="Gray" StrokeThickness="1"
Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}"/>
              </VisualBrush.Visual>
          </VisualBrush>
      </Border.BorderBrush>
  </Border>
复制代码
BorderThickness="1" 只设置一个值时表示4条边都是一样的大小  
相关推荐
bugcome_com18 小时前
WPF 命令 ICommand 从原理到实战
后端·wpf·icommand
武藤一雄2 天前
WPF处理耗时操作的7种方法
microsoft·c#·.net·wpf
Venom842 天前
我的 WPF Powermill 工具
wpf
一念春风3 天前
证件照制作工具(WPF C#)
c#·wpf
He BianGu4 天前
【笔记】在WPF中GiveFeedbackEventHandler的功能和应用场景详细介绍
笔记·wpf
就是有点傻4 天前
WPF自定义控件-水晶球
wpf
He BianGu4 天前
【笔记】在WPF中QueryContinueDragEvent的详细介绍
笔记·wpf
He BianGu4 天前
【笔记】在WPF中QueryCursor事件的功能和应用场景详细介绍
笔记·wpf
He BianGu4 天前
【笔记】在WPF中CommandManager的功能和应用场景详细介绍
笔记·wpf
关关长语4 天前
HandyControl中Button图标展示多色路径
c#·.net·wpf·handycontrol