c#中DataGridView使用的相关整理2

整理来自于https://bbs.csdn.net/topics/350232824https://heisetoufa.iteye.com/blog/239998

1.禁止用户调整行的高度(包括标题)

dataGridView1.AllowUserToResizeRows = false;  

2.禁止用户调整列的宽度(包括标题)

dataGridView1.AllowUserToResizeColumns = false;

3.不显示最后一行(最下面的空行).

 this.dataGridView1.AllowUserToAddRows = false;

4.获取指定单元的背景色.

dataGridView1.Row[0].Cells[0].Style.BackColor;

5.禁止编辑所有单元格.

dataGridView1.ReadOnly=true;

猜你喜欢

转载自blog.csdn.net/dd_zhouqian/article/details/89374556
今日推荐