Reputation:
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:
After stretch:
Upvotes: 0
Views: 69
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