-2

this is different question from last one. in that question I asked how to fit bigger form in different screen and the answer were helpful but did not solve the issue.

How do I fit/re-size Windows Form to any screen resolution?

I developed an application using windows forms C# under screen resolution 1366x778 and when I run my application in different screen size (different resolution) it missed some parts because the form appeared too big for the screen.

I partly solved this issued using Anchor / Docks and made the form to maximize but now the new problem is: the controls which on the form do not re-size themselves to fit the screen and they overlap each other instead.

My question is: is there any equation/function or any idea to make all the controls in the Form to re-size themselves according to the screen resolution? something like for example: lets say form1 has button1 and size of button1 is 100x100 and the new screen resolution is 1280x960, can we re-size button1 based on the resolution?

Please help . Thank you.

Community
  • 1
  • 1
Kate
  • 935
  • 4
  • 14
  • 34
  • @ Sinatr. this is different question. in that question I asked how to re-size the whole form to fit the screen and i solved it, now i asked how can I re-size controls! – Kate Feb 17 '16 at 13:07
  • 2
    It is the exact same question. The detail you somehow missed is that the screen size is completely irrelevant. You must make your UI work when the *window* is resized. So be sure to give it a resizable border and don't stop until it works acceptably whenever you drag the window corner. Cop-outs are MinimumSize so you don't have to make it work for a postage stamp and AutoScroll so you can convince the user to buy a bigger monitor. – Hans Passant Feb 17 '16 at 13:16

1 Answers1

1

Yes, there is, you have to use Anchor and Dock, read this tutorial that explains how to resize winform and controls:

http://www.techrepublic.com/article/manage-winform-controls-using-the-anchor-and-dock-properties/6165908/

TheCodeLord
  • 417
  • 6
  • 12