News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Mismatch of height and width of dialogs

Started by Mikl__, July 25, 2018, 03:02:44 PM

Previous topic - Next topic

Mikl__

I went experimentally, created a dialog and a window 276x147, the size of the window is 1 in 1, the size of the dialog is 430x279 (approximately), the correction factor for width is x1.56, the correction factor for height is x1.89. Somewhere in msdn should be, but did not find.

zedd151

Wht OS are you running, and 32 or 64 bit? Dialog boxes are a strange beast. They are not quite windows, where you can set the dimensions exactly to the pixel. But as for a 1:1 ratio, that doesn't necessarily mean the dialog box will be square. (1:1 ratio)

I think on every OS the 'correction factor' as you call it, may be different.  Dialog boxes are measured in Dialog Units IIRC. No direct correlation to size in pixels. I did my own tests years ago, and found the best solution is to make your own dialog box lib, using a regular CreateWindow call in the lib. - this way you can set the size exactly to your required dimensions.

Dialog boxes are supposed to be quicker and easier to use, using an IDE that supports drag n drop placement of controls on the dialog box for instance (or Ketil o's ResEd) but if you need exact dimensions, a window is the way to go.

jj2007

See Raymond Chen on GetDialogBaseUnits (where the author actually recommends MapDialogRect ;)). In fact, both are really messy.

Mikl__

Hi, zedd151!
I have windows seven x64
Ciao, jj2007!
Thanks for the link to Raymond Chen's work...  :t

hutch--

The recommendation long ago was to not create dialogs that had components too close to the border of the dialog window and it was evident from Win9x to Win2k and later. They appear to be of reasonably consistent size from Win2k upwards but the usual caution is advised, don't try and put components too close to the edges of another Windows version may cause some clipping of the components.

dedndave

one of the reasons i don't use dialog boxes much - lol
when i do use them, i generally size the window and controls at creation - using pixels as units  :biggrin:

jj2007

Quote from: dedndave on July 26, 2018, 01:17:19 AMi generally size the window and controls at creation - using pixels as units  :biggrin:

Yes, WM_INITDIALOG and GetDlgItem are really useful ;-)

Mikl__

Hi, hutch--, dedndave, jj2007!
Thank very mutch to all