0

http://www.shrani.si/f/P/Hn/1Um9xLS8/untitled.png

When I expand the window, the textbox contained in it is not expanded. Can I expand it automatically when I expand whole app?

I can not find property for this

http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox%28v=vs.71%29.aspx

3 Answers 3

6

The Anchor property in the designer. Set it to Left,Right,Top,Bottom. This will cause the size of the text box to be linked to the size of its parent control.

Sign up to request clarification or add additional context in comments.

Comments

6

Anchor and Dock Properties

These two properties are especially useful when you are designing your form. Ensuring that a window doesn't become a mess to look at if the user decides to resize the window is far from trivial, and numerous lines of code have been written to achieve this. Many programs solve the problem by simply disallowing the window from being resized, which is clearly the easiest way around the problem, but not the best. The Anchor and Dock properties that have been introduced with .NET lets you solve this problem without writing a single line of code.

The Anchor property is used to to specify how the control behaves when a user resizes the window. You can specify if the control should resize itself, anchoring itself in proportion to its own edges, or stay the same size, anchoring its position relative to the window's edges.

The Dock property is related to the Anchor property. You can use it to specify that a control should dock to an edge of its container. If a user resizes the window, the control will continue to be docked to the edge of the window. If, for instance, you specify that a control should dock with the bottom of its container, the control will resize itself to always occupy the bottom part of the screen, no matter how the window is resized. The control will not be resized in the process; it simply stays docked to the edge of the window.

Comments

1

try using the property "Dock", if you are working with winforms

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.