Gargoyle Gargoyle - 27 days ago 7
C# Question

How to disable resizing width of rowheader?

Is there any way to disable resizing of the width of a

DataGridView
rowheader, without setting
AllowUserToResizeRows
to False?

I've found
row.HeaderCell.Resizable
but it's readonly.

Answer

Use the DataGridView.RowHeadersWidthSizeMode Property:

Gets or sets a value indicating whether the width of the row headers is adjustable and whether it can be adjusted by the user or is automatically adjusted to fit the contents of the headers.

myGrid.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;