Reputation: 2859
How can I stop my datagridview from moving underneath the panel when the window is resized?
I have tried to dock the datagridview to the top on the window, but it just docks under the panel.
I have tried docking both to the top and docking one to the top and the other to the bottom, however they both just take half the screen up.
What I would like is if the datagridview docked to the bottom of the panel.
Upvotes: 0
Views: 168
Reputation: 35318
You have to modify the Anchor
property on your controls. Based on what you've provided, the DataGridView
control is probably anchored Bottom, Right
, and you should anchor it Top, Left
to match what the panel control's anchor is.
Also, if you do want the grid to be anchored to the bottom, right, you can set the MinimumSize
property of your form accordingly so that it can never be resized such that the controls "collide".
It's not possible without third-party controls to dock one control to another control.
Upvotes: 1