c# - DataGridView Autosize but restrict max column size -
In my C # 4.0 application, I have DataGridView of displaying some data. I want the size of the column according to the content, so I'm setting the autistic volume mode to AllCellsExceptHeader. But I want to limit the column to proceed from a certain value. There is a MinimumWidth property ... but unfortunately no MaximumWidth property.
Any ideas for how to solve it?
In advance, Frank
The only way I have this, is that columns To check the width, it has managed to check the width after adding the rows, and if it is above the size of your max, I set it manually after changing the AutoSizeMode column to DataGridViewAutoSizeColumnMode.None
foreach (MyView.Columns in DataGridViewColumn c) if (c.Width> myMax) {c.AutoSizeMode = DataGridViewAutoSizeColumnMode .None; C.Width = myMax; }
Naturally, you will need to remove AllSellsExceptHeader from AutoSizeColumnsMode when you add / update the process again and again to set / delete lines and what to do.
Comments
Post a Comment