//只读属性设置
dgv.ReadOnly = true;
//尾行自动追加
dgv.AllowUserToAddRows = false;
dgv.AllowUserToDeleteRows = false;
//行幅自动变化
dgv.AllowUserToResizeRows = true;
//高度设定
dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
//标头设定
dgv.RowHeadersVisible = true;
//标题行高
dgv.ColumnHeadersHeight = 25;
dgv.RowTemplate.Height = 23;
//行选择设定
dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
//多行选择
dgv.MultiSelect = false;
//选择状态解除
dgv.ClearSelection();
//head文字居中
dgv.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
//选择状态的行的颜色
dgv.DefaultCellStyle.SelectionBackColor = Color.LightSteelBlue;
dgv.DefaultCellStyle.SelectionForeColor = Color.Black;
//设定交替行颜色
dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.White;
dgv.RowsDefaultCellStyle.BackColor = Color.LightGray;
//行副填充时自动调整宽度
dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgv.AutoGenerateColumns = false;
//可否手动调整行大小
dgv.AllowUserToResizeRows = false;
dgv.AutoGenerateColumns = false;
dgv.ReadOnly = true;
//尾行自动追加
dgv.AllowUserToAddRows = false;
dgv.AllowUserToDeleteRows = false;
//行幅自动变化
dgv.AllowUserToResizeRows = true;
//高度设定
dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
//标头设定
dgv.RowHeadersVisible = true;
//标题行高
dgv.ColumnHeadersHeight = 25;
dgv.RowTemplate.Height = 23;
//行选择设定
dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
//多行选择
dgv.MultiSelect = false;
//选择状态解除
dgv.ClearSelection();
//head文字居中
dgv.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
//选择状态的行的颜色
dgv.DefaultCellStyle.SelectionBackColor = Color.LightSteelBlue;
dgv.DefaultCellStyle.SelectionForeColor = Color.Black;
//设定交替行颜色
dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.White;
dgv.RowsDefaultCellStyle.BackColor = Color.LightGray;
//行副填充时自动调整宽度
dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgv.AutoGenerateColumns = false;
//可否手动调整行大小
dgv.AllowUserToResizeRows = false;
dgv.AutoGenerateColumns = false;