C#中DataGridView的样式

2021-07-21 19:54

阅读:431

dg.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);

//for (int i = 0; i

//{

//    int bestWidth = dg.Columns[i].GetPreferredWidth(DataGridViewAutoSizeColumnMode.AllCells, false);

//    dg.Columns[i].MinimumWidth = bestWidth;

//    //dg.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.None;

//    dg.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

//}


评论


亲,登录后才可以留言!