zoukankan      html  css  js  c++  java
  • WinForm DataGridView制作表格

    1、  将背景颜色改为白色

      this.dataGridView1.BackgroundColor = Color.White;

         或

      

    2、 禁止启用添加,启用编辑,启用删除

      this.dataGridView1.AllowUserToAddRows = false;

      this.dataGridView1.AllowUserToDeleteRows = false;

      this.dataGridView1.ReadOnly = true;

      或

      

      

    3、 禁止显示行标题的列

      this.dataGridView1.RowHeadersVisible = false;

        或

       

    4、 创建列,并绑定字段

       

      设置列宽:

       

      列标题居中,设置编辑,设置字体样式:

       

      

      文本内容居中,并设置字体:

       

      

    5、  禁止调整列,行的大小

       

      或

       

    6、  设置网格线

      //取消视觉样式

       

      //设置网格线样式和颜色

       

       

       

       

           //如果不需要滚动条可以在这里设置

       

       //取消DataGridView边框

      

           //让列宽,行自适应

      

     最后绑定数据源,运行效果如下:

      

  • 相关阅读:
    【bzoj2669】[cqoi2012]局部极小值 容斥原理+状压dp
    默默的等式
    P3403 跳楼机
    作物
    【bzoj3174】[Tjoi2013]拯救小矮人
    【bzoj4976】宝石镶嵌
    BZOJ2121-字符串游戏
    mzf的考验
    牛客网round1
    jloi2015
  • 原文地址:https://www.cnblogs.com/haibing0107/p/7468533.html
Copyright © 2011-2022 走看看