Click here to Skip to main content
15,937,066 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm currently working on the MFC application in Visual Studio 2017 which is having the dialogs designed for resolution 1920 x 1080, but now I want to modify it and make it scalable for all resolution.

What changes should I make to the application so that the application fits to all the screen size irrespective of resolution.

What I have tried:

I thought of using "movewindow()" and "setwindowpos()" functions but didn't try as there were many controls on the screen and did not know how to move them all together.
Posted
Updated 23-Jan-23 6:25am

Unless your app is designed from the ground up to work well in all resolutions, you pretty much can't - it's just too much work.

If your app is designed like VS (workspace in the middle with variable font and font size with "dockable" toolboxes and suchlike all round the edges and almost no buttons at all other than toolbars) then it's simple: the user sets the font size for "editing" and everything else flows round it.

But if your app is a dialog covered in buttons and text boxes, the it's a total nightmare!
For example, if the resolution goes up but you don't increase the button size then they just gets spaced apart massively, and it looks stupid - plus the text becomes too small to read and the user ends up unable to us it.
If you do increase the buttons size, then you can keep the proportions right, but unless you also scale the text it still looks dumb: a large button with tiny text in the centre which may or may not be readable. If you do scale the text, then that may get "SHOUTY" on a large monitor.

Conversely, if you lower the resolution, you get the same problems in reverse: overlapping buttons, text to small to read, or too big to fit on the button.

Generally speaking, unless you thought about this right from the start it's a bad idea!

Since we have no idea how you app is designed (but your description sounds a lot more "dialog" than "flexible") we can't really help you.
 
Share this answer
 
Since Windows 10, an application can be notified about dpi changes via its HWNDs. In addition, automatic DPI scaling of non-client area, bitmaps in controls and dialog boxes is provided. Desktop applications must notify Windows if they support DPI scaling.

High DPI Desktop Application Development on Windows
https://learn.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows

MFC applications now default to being DPI-aware
https://devblogs.microsoft.com/cppblog/mfc-applications-now-default-to-being-dpi-aware/

How to make your MFC program support high DPI - The easy Way
https://www.softwareverify.com/blog/how-to-make-your-mfc-or-non-mfc-program-support-high-dpi-monitors-the-easy-way/
 
Share this answer
 

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