Thomas
Thomas

Reputation: 34188

Control sizing and position will change when form will resize in win form application c#

suppose i have label and button on textbox and i want that if i resize my win form then my label and button size and position will change. i got the solution in wpf but i am working with win form apps. here i am giving the url from where you can see what kind of output i am looking form. the url is https://i.sstatic.net/QeoVK.png. please see the image and tell me how can i implement the same output in win form apps. please help me with code snippet in c#.thanks.

Upvotes: 0

Views: 1920

Answers (3)

Lukáš Novotný
Lukáš Novotný

Reputation: 9052

Use Anchor and Dock properties for simple stuff and SizeChanged event for more complicated stuff. UI positioning API is much more limited than WPF and you will probably have to do stuff like scaling manually.

Upvotes: 0

Davide Piras
Davide Piras

Reputation: 44605

consider that window forms and WPF are very different, especially about the UI management and controls nesting / UI composition.

I have seen some articles describing what you are trying to do now in windows forms, long ego, it's something called control scaling if I recall well.

Upvotes: 1

Fredrik Mörk
Fredrik Mörk

Reputation: 158319

You should make yourself familiar with the Anchor and Dock properties of the controls. They are great tools for this kind of work.

Note though that they will alter the size of the controls only, they will not affect font size.

Upvotes: 3

Related Questions