Click here to Skip to main content
15,886,798 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a windows forms application and i need it to be full screen every time. even when the screen resolution changed.

What I have tried:

I checked but couldn't find any related articles. I can remember there was some codes, programmatically adjust the form size in vb6 but theres nothing for c#
Posted
Updated 28-May-21 20:00pm

Quote:
Actually I need to resize the controllers that are inside with the form too. This does only the main form right?


What I assume you mean is that your want the content of the form to resize itself to match the resolution of the screen.

That's complicated: you can do some of it with the Anchor and Dock properties of each control, but that only goes so far - it will not resize fonts and so forth, so you end up with tiny buttons and text that doesn't fit, or huge buttons with tiny text in the middle.
And other than handling Resize for every control on your form, working out what font size to use and applying it on a case by case basis there is no way to do that.

And generally speaking, that tends to look pretty bad anyway!

You can really only resize to fit screens if your whole app interface was originally designed to do that: something like the way Visual Studio works, with a central text section and dockable tools around the edges - but that's a UI that works for some applications only, and we have no idea what your app does, or how your UI is laid out.

WPF handles it better, but ... WPF is it's own separate can-of-worms!

Basically, you need to look at how your app UI is organised and work out on an individual basis what to do. Sorry, but there is no "do this, it'll work" answer we can give you.
 
Share this answer
 
Comments
Prachith Goonasekara 29-May-21 6:59am    
Yes that's what I gathered too. I read other articles and all were saying the same thing. Anyway thanks for clarifying.
OriginalGriff 29-May-21 8:30am    
You're welcome!
Good luck.
 
Share this answer
 
Comments
Prachith Goonasekara 29-May-21 1:27am    
Actually I need to resize the controllers that are inside with the form too. This does only the main form right?
Wendelius 29-May-21 1:59am    
Yes, WindowState changes only the state of the form. For individual controls I'd prefer anchoring. See Anchor Controls - Windows Forms .NET Framework | Microsoft Docs[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900