jeudi 12 mars 2015

Resize DataGridView At Runtime

I need my DataGridView to resize when the form is maximized and minimized.


I have tried the following:



DGVItem = new System.Drawing.Size(this.Parent.Width - 20, this.Parent.Height - 50);


I have also tried:



DGVItem.Height = this.Parent.Heigth - 50;
DGVItem.Width = this.Parent.Width - 20;


Neither of these methods work.


Any help would be appreciated.


EDIT


I have now also tried the anchor properties as follows:



DGVItem.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);


Does not work at runtime.


Aucun commentaire:

Enregistrer un commentaire