The API mentions dialog box units. Anybody know what datatype these are and how to convert pixels to dbu's?
Posted on 2002-01-22 12:32:25 by rdaneel
Take a look at GetDialogBaseUnits . This confuses me a bit though -
I thought DLU->pixel was constant for all dialogs on a system (but
it can vary from system to system depending on whether you use
"small fonts" or "large fonts".)
Posted on 2002-01-22 12:43:17 by f0dder
Yes, they are font dependent. The X dialog unit is the average width of a system default font character divided by 4 and the Y dialog unit is the average height divided by 8. If you don't change your default system font they are constant (on your system :grin:).
Posted on 2002-01-22 13:01:02 by LuHa
Thanks guys. I wanted a 422 x 278 dialog box so I used this formula from the GetDialogBaseUnit help and it seems to work fine:



invoke GetDialogBaseUnits
mov baseunitX, ax ;Store horizontal base unit
shr eax, 16
mov baseunitY, ax ;Store vertical base unit

mov ax, (4 * 422)
mov dx, 0
div baseunitX
mov dialogunitX, ax

mov ax, (8 * 278)
mov dx, 0
div baseunitY
mov dialogunitY, ax
Posted on 2002-01-22 13:06:46 by rdaneel