How to determine the DPI setting


2003-11-29 03:46:18 AM
cppbuilder0
How can I get the DPI setting value of the used system font?
I mean,
if normal fonts are used this will be 96 (DPI)
if large fonts are used this will be 120 (DPI)
else the user can adjust this value by entering Display Properties->Settings
->Advanced->DPI setting->Custom Setting on the popup menu which opens when
the user clicks right mouse button on desktop.
The problem is:
the width of the Form is 200 pixels. It works well on a computer where
normal fonts
are used. On a computer where large fonts are used the width remains 200
pixels and this causes horizontal and vertical scroll bars to be displayed
since the x-coordinate of some buttons are greater than 200.
I'm thinking about adjusting the width after getting the value of DPI.
Form1->Width = (int)(Form1->Width*value/96.0);
Thanks...