Because I used to use VC to do UI work. When I started using VC to do UI, I have encountered some problems that are very puzzled.
In the dialog editor, I initially thought that the length unit of all controls is based on pixels. Later, I found it is not big, the size of the control show is obviously more than the corresponding pixel size, and the query information is found. These lengths are in DLU.
What is DLU, DLU is the abbreviation of Dialog Unit, and literally meaning nature is a dialog unit.
How DLU is defined, this is related to another unit Dialog Base Unit-dialog box basic unit, this dialog box is related to the fonts selected by the dialog, the number of pixels of the unit level Dialog Base Unit is probably The average width (pixel unit) of all characters in this font is probably the number of pixels of the Dialog Base Unit is the average length of all characters in this font.
The number of pixels of the unit level DLU is the unit level DLBU / 4, and the number of pixels of the unit vertical DLU is the unit vertical DLBU / 8.
Ah, this is a complicated, but in general, the level DLU and vertical DLU are the same. When using the system font, the font size is 8th, a DLU corresponds to 1.5 pixels. As for other fonts and sizes, there is a related API can be calculated, but it is really cumbersome, but fortunately there is no opportunity to use, if you need to check MSDN.
Why use DLUs in the dialog editor as a unit (recorded to the length of the RC resource file is also in units), naturally, when the dialog font changes, the program loads the dialog, the DLU follower is calculated. The relationship between dynamically defines the size of the dialog box and the control, avoiding the string caused by changing the font to exceed the length of the predetermined length.