user8123187
user8123187

Reputation:

I want to align controls that stretches horizontally like google chrome browser address bar

I am trying to align few buttons and a textbox, like the Google Chrome browser address bar, which stretches itself when the user maximizes windows form.

I tried anchor and dock, but 1st control from the left and last control from the right side align themselves but other middle controls stays put.

Please anybody tell me how to properly align controls?

Here's my controls in panel:

enter image description here

After stretch: enter image description here

Upvotes: 0

Views: 69

Answers (1)

Abhishek
Abhishek

Reputation: 2945

Don't use Dock property. For the controls before the TextBox, leave the Anchor property to default, i.e., Left, Top.

For the TextBox, set the anchor to Left, Right, Top.

And for controls after the TextBox, use Right, Top.

This will resize only the TextBox when you change the window size.

Upvotes: 2

Related Questions