Common Properties of DataGridView Control in C#

1. Remove the option to add rows in the last row of the datagridview control

  • AllowUserToAddRow : False 

2. Remove the column containing the row header in the first column of the datagridview control (blank column)

  • RowHeadersVisble : False 

  •  AllowUserToAddRows=false;

3. Automatic resizing of visible columns of datagridview control

  • AutoSizeColumnsMode : Fill

4. The datagridview control selects a row of data

  • SelectionMode : FullRowSelect 

5. Users are not allowed to adjust the size of all columns of the datagridview control

  • AllowUserToResizeColumns : False 

6. Users are not allowed to adjust the size of all rows of the datagridview control

  • AllowUserToResizeRows : False

7. Set the datagridview control column title text to be centered

  • DataGridViewContentAlignment:MiddleCenter

8. Users are not allowed to edit the datagridview control (read-only attribute)

  • ReadOnly:true

The above attributes are used by the editor in the process of refactoring the computer room. The attributes of the DataGridView control are more than these. Later, the editor will add more when encountering them. Welcome to comment on the attributes you know below!

 

Guess you like

Origin blog.csdn.net/TGB_Tom/article/details/113089228