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;
}

 

posted @ 2014-05-17 16:49  大漠孤烟~  阅读(295)  评论(0编辑  收藏  举报