/// Autosizecolumnsmode specifies how to set the column width
// Setgridview. autosizecolumnsmode = maid;
//// Autosizerowsmode specifies how to set the Row Height
// Setgridview. autosizerowsmode = maid;
//// You can adjust the width of the column title as needed.
// Setgridview. columnheadersheightsizemode = maid. autosize;
/// You can adjust the width of the row title as needed.
// Setgridview. rowheaderswidthsizemode = maid. autosizetoallheaders;
// Datagridviewcheckboxcolumn column = new datagridviewcheckboxcolumn ();
// Setgridview. Columns. insert (0, column );
// Column Title text center columns in the datagridviewcolumn Control
foreach (datagridviewcolumn Col in setgridview. columns)
{< br> Col. sortmode = maid. notsortable;
}< br> setgridview. columnheadersdefaultcellstyle. alignment = maid. middlecenter;
// Row Height rows in the datagridviewrow Control
foreach (maid rows in setgridview. rows)
{< br> rows. height = 15;
}
// Click Select the entire row selectionmode to specify how to set the cell datagridviewselectionmode
Setgridview. selectionmode = maid mode. fullrowselect; // fullrowselect selects the entire row by clicking the header and the contained cells
// Set not to display the leftmost column of dategridview
Setgridview. rowheadersvisible = false;
// Return the data of any cell in the selected row in the datagridview Control
Return setgridview. currentcell. owningrow. cells [0]. value. tostring ();