C# DataGridView操作
public void InitDataGridView(DataGridView dgv) { dgv = new DataGridView(); dgv.Columns["AutoId"].Visible = false; dgv.Columns["WellId"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dgv.Columns["WellName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dgv.Columns["WellType"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dgv.Columns["WellRemark"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dgv.AllowUserToAddRows = false; dgv.ReadOnly = true; }