Home > Mobile >  How to make C# winform responsive
How to make C# winform responsive

Time:11-17

I want to make responsive windows form app layout that needs to be responsive to any windows size

for example, when we want to reduce windows size all elements become small as well

I have seen that some users said that we can make all elements stick or use methods but I'm looking for an efficient one and easy as well

CodePudding user response:

Like others already mentioned what you're looking for are the control properties Dock and Anchor which define how an objects size and position should change according to it's parent container.

  • With Control.Dock you can dock an object to an edge of it's parent container and it will remain there even when you resize your form. An example would be a navigation menu that's always docked to one side of your Form.

    enter image description here

  • With Control.Anchor you can anchor one or more edges of an object to it's parent container. That means you can place an object anywhere, anchor it to one or more sides and the defined sides will "stick" to it's parent containers sides when resizing.

    enter image description here

What could also be of use for you is the Screen Class (Documentation) for example if you're trying to determine the Screens Resolution and set your forms Size accordingly.

CodePudding user response:

see this Link : Control.Dock Property

  • Related