Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form resize event 1

Status
Not open for further replies.

euntair

Programmer
Sep 13, 2007
53
US
I have the following code resizing a textbox. The width is working as expected but the height isn't responding. What am I missing?

private void Form1_Resize(object sender, System.EventArgs e) {
Control control = (Control)sender;
textBox1.Size = new Size(Form1.ActiveForm.Size.Width - 8, Form1.ActiveForm.Size.Height-92);
}
 
Why are you manually adjusting width/height?

That's what the Dock and Anchor properties are for.

If you aren't docking, just set Anchor to Top, Bottom, Left, Right

 
The Height of a TextBox is fixed (determined by the Font), unless the MultiLine property is set to True.


Hope this helps.

[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top