Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Designing an MFC App That Will Work on All Resolutions?

I'm currently designing my first ever GUI for Windows. I'm using MFC and Visual Studio 2008. The monitor I have been designing my program on has 1680x1050 native resolution. If I compile and send my program to one of my coworkers to run on their computer (generally a laptop running at 1024x768), my program will not fit on their screen.

I have been trying to read up on how to design an MFC application so that it will run on all resolutions, but I keep finding misleading information. Everywhere I look it seems that DLUs are supposed to resize your application for you, and that the only time you should run into problems is when you have an actual bitmap whose resolution you need to worry about. But if this is the case, why will my program no longer fit on my screen when I set my monitor to a lower resolution? Instead of my program "shrinking" to take up the same amount of screen real estate that it uses at 1680x1050, it gets huge and grainy.

The "obvious" solution here is to set my resolution to 1024x768 and redesign my program to fit on the screen. Except that I've already squished everything on my dialogs as much as possible to try and get my program to fit on screen running at 1024x768. My dialog fonts are set to Microsoft Sans Serif 8 but still appear huge (much larger than 8 points) when running at 1024x768.

I know there HAS to be a way to make my program keep the same scaling... right? Or is this the wrong way to approach the problem? What is the correct/standard way to go about designing an MFC program so that it can run on many resolutions, say 800x600 and up?

like image 541
Lauren Avatar asked Jun 25 '09 22:06

Lauren


People also ask

Is MFC obsolete?

No, it's not "deprecated".


1 Answers

I assume your application GUI is dialog based (the main window is a dialog)?

In that case you have a problem, because, as you discovered, MFC has no support for resizing a dialog correctly. Your options are:

  • Redesign your GUI to use a SDI or MDI GUI.
  • Use a dialog resize extension. There are many available, for some very good suggestions see this question. Another options are this one and this one.
  • Don't use MFC. wxWidgets has much better support for dialog resizing.
like image 119
Dani van der Meer Avatar answered Sep 30 '22 14:09

Dani van der Meer