Datagridview 表头常规

this.dataGridView1.ReadOnly = true;
this.dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
this.dataGridView1.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
this.dataGridView1.ScrollBars = ScrollBars.Vertical;
dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
dataGridView2.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;

dataGridView1.AllowUserToAddRows = false;
dataGridView1.AutoResizeColumns();
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
dataGridView1.MultiSelect = false;

dataGridView1.Columns.Clear();
dataGridView1.RowHeadersVisible = false;
dataGridView1.Columns.Add("id", "序号");
dataGridView1.Columns.Add("name", "名称");

Datagridview 表头常规

上一篇:C# HttpListener 监听 + Queue 队列 接收存储数据


下一篇:C# JSON动态解析