-
Dialog window size
I've noticed that it is possible to see the size of a dialog window in the status bar, far to the right when working in VC++ 6.
I want a main dialog window to be 640x480. The problem is that when i set this size then it takes up far more than a quarter of my screen (which is set to 1280x1024). When I create a popup dialog and set its size to 640x480 it looks right on my screen and it is a lot smaller than the main dialog, which should be the same size.
What can be done to solve this problem?
Thanks for any help!
-
Your dialog resource is measured in dialog units, which are proportional to the font being used in the dialog (which can be the default). So in the first case, the size is 640x480 DLUs.
In the second case, your popup "dialog" (I think it's a window but I can't see your code) is measured in pixels.
If you want the main dialog to be 640x480 pixels, try using a SetWindowPos call when it receives a WM_INITDIALOG message, like so:-
Code:
SetWindowPos(hwndDlg, NULL, 0, 0, 640, 480, SWP_NOMOVE | SWP_NOOWNERZORDER);
The advantage of dialog units is that dialogs will take up similar amounts of space at a variety of resolutions (because the font their based on is scaled).