Hi Michael,
Thank you for your reply!
(1) In the workaround I gave you in my previous reply, once a
DataGridViewColumn's width reaches a given maximum, this column's
AutoSizeMode property is set to None, which means this column will not
autosize with its cell content unless its AutoSizeMode property is set to
NotSet again.
I think in my situation this could be simplified because I only need to
size the
columns when I load the DataGridView with data, though this could happen
many times during a given run.
If the data source bound to the DataGridView remains the same and you only
load data into the data source many times, you do need to handle the
CellValueChanged event of the DataGridView in case that the actually
required column widths become shorter than the given maximum value in the
later data loading.
(2) The workaround I provided in my previous reply has already met this
requirement. Once a column autosizes up to a given maximum, its
AutoSizeMode property is set to None so that the user can grab the column
separator to resize the column manually as he/she likes.
Hope this helps.
If you have any question, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support