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条边都是一样的大小  
相关推荐
陆鳐LuLu2 小时前
WPF 在图像编辑工具开发中的优势
wpf
快乐非自愿12 小时前
分布式锁—Redisson的同步器组件
分布式·wpf
△曉風殘月〆17 小时前
WPF预览并打印FlowDocument
wpf
wangnaisheng17 小时前
【WPF】Slider滑动方法(INotifyPropertyChanged、ValueChanged )响应速度对比分析
c#·wpf
蒋劲豪17 小时前
WPF有哪些使用率高的框架
c#·wpf
wangnaisheng17 小时前
【WPF】在System.Drawing.Rectangle中限制鼠标保持在Rectangle中移动?
c#·wpf
中土 不易2 天前
WPF中XAML的优点
wpf
无所谓จุ๊บ2 天前
使用AI整理知识点--WPF动画核心知识
c#·wpf
xcLeigh3 天前
WPF在特定领域的应用:打造一款专业的图像编辑工具
c#·wpf
吾与谁归in4 天前
WPF给ListBox中的每一项添加右键菜单功能
c#·wpf