I found a lot of questions about how to resize the form when a child control resizes, but I\'m trying to do something much simpler (maybe so simple people don\'t even ask it
Set the property of your DataGridView:
Anchor: Top,Left
AutoSizeColumn: Fill
Dock: Fill
Unless I am misunderstanding what you are asking you can do this on the properties for your data grid view. You need to set the Anchor property to the sides you want it locked to.
For me, anchoring works only if I set it to all four sides:
Anchoring: Top, Bottom, Left, Right
Setting anchoring just to Left, Bottom moves the whole object when the form is resized in bottom, left side. Setting all four sizes really resizes the object, when parent is resized.
In your form constructor you could create an event handler like this:
this.SizeChanged(frm_sizeChanged);
Then create an event handler that resizes the grid appropriately, example:
private void frm_sizeChanged(object sender, EventArgs e)
{
dataGrid.Size = new Size(100, 200);
}
Replacing those numbers with whatever you'd like.
Set the anchor property of the control to hook to all sides of the parent - top, bottom, left, and right.
You have to chose 'Fill' in the Dock property.