当前位置: 首页 > news >正文

网页制作网站首页设计推广平台网站

网页制作网站首页设计,推广平台网站,高级采矿平台建立在小行星带,接网站开发做多少钱最近项目中使用到了Grid表格#xff0c;居然要加边框#xff0c;查了一下#xff0c;grid原生居然是不支持实线边框的。。最终我还是实现了效果#xff0c;看看吧#xff1a;左边是直接写的每行一个border,每列写一个border,这样在行列比较少的时候还行#xff0c;如果多… 最近项目中使用到了Grid表格居然要加边框查了一下grid原生居然是不支持实线边框的。。最终我还是实现了效果看看吧左边是直接写的每行一个border,每列写一个border,这样在行列比较少的时候还行如果多了那不惨了项目中我就这样写的了反正能实现效果了。。。右边是使用附加属性动态添加的border,还行吧有不少缺点比如不能处理单元格合并的问题。先不管了反正我也用不到哈哈。下面就看看代码吧新建一个GridProperties类用来 放附加属性的定义using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace wpfcore {public class GridProperties{public static bool GetShowBorder(DependencyObject obj){return (bool)obj.GetValue(ShowBorderProperty);}public static void SetShowBorder(DependencyObject obj, bool value){obj.SetValue(ShowBorderProperty, value);}public static readonly DependencyProperty ShowBorderProperty DependencyProperty.RegisterAttached(ShowBorder, typeof(bool), typeof(Grid), new PropertyMetadata(false,OnShowBorderChanged));private static void OnShowBorderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e){if (!(d is Grid grid)) return;grid.Loaded OnLoaded;}private static void OnLoaded(object sender, RoutedEventArgs e){if (!(sender is Grid grid)) return;var rowCount grid.RowDefinitions.Count;var columnCount grid.ColumnDefinitions.Count;var thickness new Thickness(1);var bottomThickness new Thickness(0,0,0,1);var rightThickness new Thickness(0,0,1,0);var headerBack new SolidColorBrush(Color.FromArgb(255, 129, 133, 145));for (int i 0; i rowCount; i){Border border new Border(){BorderBrush Brushes.Black,BorderThickness i 0 ? thickness : bottomThickness,Background i 0 ? headerBack : Brushes.Transparent,};border.SetValue(Panel.ZIndexProperty, -1000);border.SetValue(Grid.RowProperty, i);border.SetValue(Grid.ColumnProperty, 0);border.SetValue(Grid.ColumnSpanProperty, columnCount);grid.Children.Add(border);}for (int i 0; i columnCount; i){Border border new Border(){BorderBrush Brushes.Black,BorderThickness i 0 ? thickness : rightThickness,Background Brushes.Transparent,};border.SetValue(Panel.ZIndexProperty, -1000);border.SetValue(Grid.RowProperty, 0);border.SetValue(Grid.ColumnProperty, i);border.SetValue(Grid.RowSpanProperty, rowCount);grid.Children.Add(border);}grid.Loaded - OnLoaded;}} } 然后在MainWindow的测试代码Window x:Classwpfcore.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:localclr-namespace:wpfcoremc:IgnorabledBackgroundLightBlueUseLayoutRoundingTrueTitleMainWindow Width820 Height340GridGrid.ColumnDefinitionsColumnDefinition/ColumnDefinition//Grid.ColumnDefinitionsStackPanel Margin30 VerticalAlignmentCenter HorizontalAlignmentCenterTextBlock Text直接写 Border的方式添加 FontSize18 Margin10 ForegroundGreen HorizontalAlignmentCenter/Grid Width300 Height150 Grid.ResourcesStyle TargetTypeTextBlockSetter PropertyHorizontalAlignment ValueCenter/Setter PropertyVerticalAlignment ValueCenter/Setter PropertyFontSize Value16/Setter PropertyFontFamily Value微软雅黑/ /StyleStyle TargetTypeBorder Setter PropertyBorderBrush ValueBlack/Setter PropertyBorderThickness Value1/ /Style/Grid.ResourcesGrid.ColumnDefinitionsColumnDefinition Width1.5*/ColumnDefinition Width1*/ColumnDefinition Width2*/ColumnDefinition Width1*//Grid.ColumnDefinitionsGrid.RowDefinitionsRowDefinition /RowDefinition /RowDefinition /RowDefinition //Grid.RowDefinitionsBorder Grid.Row0 Grid.Column0 Grid.ColumnSpan4 Background#818591/Border Grid.Row1 Grid.Column0 Grid.ColumnSpan4 BorderThickness0 0 0 1/Border Grid.Row2 Grid.Column0 Grid.ColumnSpan4 BorderThickness0 0 0 1/Border Grid.Row3 Grid.Column0 Grid.ColumnSpan4 BorderThickness0 0 0 1/Border Grid.Row0 Grid.Column0 Grid.RowSpan4 /Border Grid.Row0 Grid.Column1 Grid.RowSpan4 BorderThickness0 0 1 0/Border Grid.Row0 Grid.Column2 Grid.RowSpan4 BorderThickness0 0 1 0/Border Grid.Row0 Grid.Column3 Grid.RowSpan4 BorderThickness0 0 1 0/TextBlock Grid.Row0 Grid.Column0 Text姓名/TextBlock Grid.Row0 Grid.Column1 Text年龄/TextBlock Grid.Row0 Grid.Column2 Text兴趣爱好/TextBlock Grid.Row0 Grid.Column3 Text性别/TextBlock Grid.Row1 Grid.Column0 TextWPF UI/TextBlock Grid.Row1 Grid.Column1 Text3M/TextBlock Grid.Row1 Grid.Column2 Text分享代码/TextBlock Grid.Row1 Grid.Column3 Text汉子//Grid/StackPanelStackPanel Grid.Column1 Margin30 VerticalAlignmentCenter HorizontalAlignmentCenterTextBlock Text使用附加属性添加 FontSize18 Margin10 ForegroundGreen HorizontalAlignmentCenter/Grid Width300 Height150 local:GridProperties.ShowBorderTrueGrid.ResourcesStyle TargetTypeTextBlockSetter PropertyHorizontalAlignment ValueCenter/Setter PropertyVerticalAlignment ValueCenter/Setter PropertyFontSize Value16/Setter PropertyFontFamily Value微软雅黑/ /StyleStyle TargetTypeBorderSetter PropertyBorderBrush ValueBlack/Setter PropertyBorderThickness Value1/ /Style/Grid.ResourcesGrid.ColumnDefinitionsColumnDefinition Width1.5*/ColumnDefinition Width1*/ColumnDefinition Width2*/ColumnDefinition Width1*//Grid.ColumnDefinitionsGrid.RowDefinitionsRowDefinition /RowDefinition /RowDefinition /RowDefinition /RowDefinition //Grid.RowDefinitionsTextBlock Grid.Row0 Grid.Column0 Text姓名/TextBlock Grid.Row0 Grid.Column1 Text年龄/TextBlock Grid.Row0 Grid.Column2 Text兴趣爱好/TextBlock Grid.Row0 Grid.Column3 Text性别/TextBlock Grid.Row1 Grid.Column0 TextWPF UI/TextBlock Grid.Row1 Grid.Column1 Text3M/TextBlock Grid.Row1 Grid.Column2 Text分享代码/TextBlock Grid.Row1 Grid.Column3 Text汉子//Grid/StackPanel        /Grid /Window 以上xaml就能实现视频中的效果啦如果喜欢点个赞呗~您的点赞是我更新的动力~
http://www.pierceye.com/news/765021/

相关文章:

  • 网站开发一般多少钱规划设计公司毛利
  • .net 网站地图高端网站建设 n磐石网络
  • 商丘网站建设价格无锡网站建设制作公司
  • 做装饰材料的网站dede英文网站
  • 长沙招聘网站哪个最好网站登录页面html模板
  • 网页创建网站做商城网站报价
  • 网网站建设公司网络整合营销
  • 广州本地门户网站wordpress视频格式
  • 做网站如何购买服务器自己做的网站注册用户无法收到激活邮箱的邮件
  • 商城网站系统建设中信建设有限责任公司 吴方旭
  • 辽阳市建设行业培训中心网站蒙文门户网站建设
  • 凡科建站官网入口wordpress个性首页
  • 上海信息技术做网站不连接wordpress安装
  • 高端网站开发培训免费企业黄页查询网站
  • 最新的网站开发技术全国新冠新增最新消息
  • 试玩app推广网站建设广州网站维护制作
  • 2018年网站设计公司阿里巴巴网官方网站
  • 英文网站常用字体icp备案的网站名称
  • 扬州恒通建设网站镇江润州区建设局网站
  • 关于网站制作的论文网站注册时间
  • 一个人可以备案几个网站做图去哪个网站找素材
  • 江苏建设管理信息网站自己可以做装修效果图的网站
  • html网站欣赏杭州战争网站建设
  • 乐清市做淘宝网站公司网站支付体现功能怎么做
  • 做网站公司促销海报本网站只做信息展示
  • 网站建设商城模板仿我喜欢网站源码免费
  • 工商服务网优化网站推广
  • 嘉兴网站系统总部做一个网站一般要多少钱
  • win10电脑做网站网站为什么有价值是
  • 凡科网站建设视频impreza 4 wordpress