And the formula is ..
Each horizontal base unit is equal to 4 horizontal dialog template units; each vertical base unit is equal to 8 vertical dialog template units. Therefore, to convert dialog template units to pixels, use the following formulas:
Similarly, to convert from pixels to dialog template units, use the following formulas:
Code:
pixelX = MulDiv(templateunitX, baseunitX, 4); pixelY = MulDiv(templateunitY, baseunitY, 8);
Code:
templateunitX = MulDiv(pixelX, 4, baseunitX); templateunitY = MulDiv(pixelY, 8, baseunitY);
For either type of dialog box, it is easier to use the MapDialogRect function to perform the conversion. MapDialogRect takes the font into account and correctly converts a rectangle from dialog template units into pixels.
Leave a comment: