How Can a Textbox Be Dynamically Resized with the Form?

  • Thread starter Thread starter CodeMonkey
  • Start date Start date
  • Tags Tags
    Forms
Click For Summary

Discussion Overview

The discussion revolves around dynamically resizing a textbox in relation to a form's size during runtime. It focuses on practical implementation within a specific programming context, likely involving user interface design in a Windows application.

Discussion Character

  • Technical explanation

Main Points Raised

  • One participant expresses a need for a solution to resize a textbox relative to a form's size.
  • Another participant clarifies that the discussion pertains to Windows and inquires about the programming language being used.
  • A third participant suggests using the Anchor property of the textbox control in C# to achieve the desired resizing behavior.
  • A later reply confirms that the suggested solution worked for the original poster.

Areas of Agreement / Disagreement

Participants appear to agree on the solution involving the Anchor property, as it was confirmed to work for the original poster. However, the initial inquiry about the programming language indicates some uncertainty about the context.

Contextual Notes

The discussion assumes familiarity with Windows Forms and C# programming, which may limit its applicability to other environments or languages.

Who May Find This Useful

Developers working with Windows Forms in C# who are looking for ways to create responsive user interfaces.

CodeMonkey
Messages
11
Reaction score
0
I searched Google and could not find a solution for this.

I have a form with a text box and I want to make it so that when I resize the form while the application is running the text box would get resized as well and be "relative" to the size of the form.

Any help please?
 
Technology news on Phys.org
Obviously this is Windows (not Xterm)? Less obviously - what language are you coding in?
 
CodeMonkey, I think what you want to do is set the Anchor property of your text field. This is a property of all Controls:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.anchor.aspx

Assuming this is C#, I think you want to say
yourtextbox.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
 
Coin, thanks, that worked. :-)
 

Similar threads

  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 29 ·
Replies
29
Views
6K
Replies
10
Views
2K
  • · Replies 9 ·
Replies
9
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
13
Views
2K