Click to See Complete Forum and Search --> : Solution to make project resolution independent


Rakesh Verma
May 5th, 1999, 09:06 AM
Hi,

This is one common problem with all VC++ projects.
Make a project in some resolution. compile the rc file and run the exe..

It runs fine and shows all the resources of proper size. But now if we cahnge the
resolution of the system, all screens are distorted.

If anyone knows the solution of this problem, pleae help me out. I am facing this problem.

Regards,
Rakesh Verma

Rakesh Verma
SSI, New Delhi
rverma@velos.ssind.com

shridhar rao
May 6th, 1999, 03:59 AM
You'll have to code for this to happen. There are functions like MoveWindow that moves the window to a position specified by you. You also have GetSystemMetrics function that will give you the present resolution of the screen. If you go to the resource editor you'll have the dimensions of the resource in pixels. You'll have to derive a conversion formula and use MoveWindow Later.
I hope this helps

BrianOG
May 6th, 1999, 04:06 AM
You also need to be aware of the font being used.
When changing between resolutions, the controls stay the same size (as regards pixels), but look bigger/smaller cause the size of a pixel is bigger/smaller. However, when you switch font size (between small & large fonts in Display Settings) window actually increases/decreases the size of the control to sute the font.
So when moving / resizing controls with MoveWindow be sure to test on differnet font size as well.

Rakesh Verma
May 6th, 1999, 04:23 AM
Hi,
Thanks for your response.

Does this means that I have to call MoveWindow for all controls on a dialog etc.


Regards,
Rakesh

Rakesh Verma
SSI, New Delhi
rverma@velos.ssind.com

BrianOG
May 6th, 1999, 04:30 AM
Well for a normal dialog, you shouldnt have to move any controls (unless you want to support resizing). Instead, design the dialog to fit on the screen while running 640x480 with large fonts and it should be fine for anytning.

Paul McKenzie
May 6th, 1999, 05:19 PM
The only time you need to move controls is if the dialog is resizeable (and there is code in www.codeguru.com that automatically moves your controls for resizeable dialogs).

A dialog positions the controls in dialog units, not pixels. This is why child controls of a dialog will always show up proportionately in the right places, regardless of the resolution. (You are using a dialog box, and not a "real" window, right?)

Always develop the dialogs in the lowest resolution possible (640x480). This will keep you in touch with how your screen management looks for every monitor.

Regards,

Paul McKenzie