I want a form resize event to determine whether an anchored datagridview should be in 'allcells' or 'fill' column size mode when the form is resized. When the form is sized down, the datagridview is in 'allcellls' column sizing mode so everything doesn't squish. When the form is maximized, it switches to 'fill' so the data uses the entire area of the datagridview.
Hope that makes sense.
Rob
Switching datagridview autosizecolumnmode based on form size events
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- robert.ganshorn
- Posts: 54
- Last visit: Sat Nov 25, 2023 8:17 pm
- robert.ganshorn
- Posts: 54
- Last visit: Sat Nov 25, 2023 8:17 pm
Re: Switching datagridview autosizecolumnmode based on form size events
I almost have it using:
$datagridview1.Size.Width
$datagridview1.GetPreferredSize($datagridview1.Size).Width
$datagridview1.Size.Width
$datagridview1.GetPreferredSize($datagridview1.Size).Width