Maintaining button positions relative to form

  • Thread starter Thread starter signon77
  • Start date Start date
S

signon77

How can make my buttons on a form move with the expansion/contraction
of a form.
Expanding my form leaves the buttons marooned half way up. It looks a
bit strange.

Rob
 
Either dock the button using the Button.Dock property, or add a method
to the Form.Resize event to re-size the button to the required size as
the form is re-sized.

Add something like this to the form:

this.Resize += new EventHandler(this.myForm_Resize)

private void myForm_Resize(object sender, EventArgs e)
{
this.myButton.Width = this.Width;
this.myButton.Height = this.Height;
}
 
Sorry after I writing that I noticed it stated button position not
button size.

The same principle still applies, just re positioning the button as
well as or instead of resizing it.
 
Back
Top