I have a DataGridView with the datasource set to a binding source of data. My problem is I cannot get most of the columns to resize. Several of the columns don't show a resize cursor, while two others do: one can be resized, one cannot.
Here is what I have tried:
DGV.AllowUsertoResizeColumns = True
DGV.AutoSizeColumnMode = None
DGV.RowHeadersWidthSizeMode = EnableResizing
DGV.Dock = Fill
AutoSizeMode = NoneSet
and Resizable = True
dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader)
(and other variations) after data has been loaded into the DGVHere's a screenshot of the properties of my DataGridView
:
Any Ideas?
Users can make size adjustments by dragging or double-clicking row, column, or header dividers. In column fill mode, column widths change when the control width changes; for example, when the control is docked to its parent form and the user resizes the form.
Set the DataGridView. AutoSizeColumnsMode property to Fill to set the sizing mode for all columns that do not override this value. Set the FillWeight properties of the columns to values that are proportional to their average content widths.
The DataGridView control provides a customizable table for displaying data. The DataGridView class allows customization of cells, rows, columns, and borders through the use of properties such as DefaultCellStyle, ColumnHeadersDefaultCellStyle, CellBorderStyle, and GridColor.
Upon checking the individual column settings in the gridview, I found some cells still had
AutoSizeMode = AllCells
I changed this to:
AutoSizeMode = NotSet
and now I am able to resize all columns.
Set:
AutoSizeColumnsMode = none
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With