Resource File Control Sizes

Hello -

When creating a modeless dialog box resource, I noticed that every coordinate and size for the controls is larger than it would be, had I created the same types of controls dynamically in a window procedure.

When compared to a test image of known length in pixels, the normal CreateWindow() dimensions are the correct ones, whereas the dialog resource control dimensions are about 1 1/2 to 2 times as large as they ought to be.

This is not a problem, programming-wise, because the program is 100% functional as I expect, but I was just really surprised when the first time I compiled and ran this, everything was huge.

Has anyone else had this issue? Essentially, the dialog box from the code below of width 200 shows up about twice that width. The push buttons of height 10 show up as if they're about 17 pixels high. Thank you in advance to anyone with an answer!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
IDD_MARGINS DIALOG 100, 100, 200, 100
STYLE DS_SETFONT | WS_CAPTION | WS_VISIBLE
CAPTION "Edit Margin Size (pixels):"
FONT 8, "Courier New"
BEGIN
     PUSHBUTTON "Accept", ID_ACCEPT,     140, 20, 50, 10
     PUSHBUTTON "Reset",  ID_RESET,      140, 35, 50, 10
     PUSHBUTTON "Cancel", ID_CANCEL,     140, 50, 50, 10
     EDITTEXT             ID_EDITLEFT,   50,  20, 50, 10, ES_AUTOHSCROLL | WS_TABSTOP, WS_EX_CLIENTEDGE
     EDITTEXT             ID_EDITRIGHT,  50,  35, 50, 10, ES_AUTOHSCROLL | WS_TABSTOP, WS_EX_CLIENTEDGE
     EDITTEXT             ID_EDITTOP,    50,  50, 50, 10, ES_AUTOHSCROLL | WS_TABSTOP, WS_EX_CLIENTEDGE
     EDITTEXT             ID_EDITBOTTOM, 50,  65, 50, 10, ES_AUTOHSCROLL | WS_TABSTOP, WS_EX_CLIENTEDGE
     RTEXT      "Left:",  ID_TEXT_LEFT,  18,  20, 30, 10
     RTEXT      "Right:", ID_TEXT_RIGHT, 18,  35, 30, 10
     RTEXT      "Top:",   ID_TEXT_TOP,   18,  50, 30, 10
     RTEXT      "Bottom:",ID_TEXT_BOTTOM,18,  65, 30, 10
END
Maybe the values you've set were overridden, because the caption is longer than 100 pixels and the the fontsize + padding is at min. 17 ???

Try it without text and look what happens ...


Greetz
Topic archived. No new replies allowed.