Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should use the <a href="http://msdn.microsoft.com/en-us/library/ms645502%28v=VS.85%29.aspx"><code>MapDialogRect()</code></a> function.</p> <p>Pass in a <code>RECT</code> in dialog units, and the equivalent <code>RECT</code> in pixel units is returned. Note that you need a handle to a dialog in order to give <code>MapDialogRect()</code> sufficient context. The function needs to know the font in order to perform the conversion.</p> <hr> <p>In case you are tempted to use <a href="http://msdn.microsoft.com/en-us/library/ms645475"><code>GetDialogBaseUnits()</code></a>, remember what Raymond Chen said, <a href="http://blogs.msdn.com/b/oldnewthing/archive/2004/02/17/74811.aspx">GetDialogBaseUnits is a crock</a>.</p> <blockquote> <p>As you can guess from the title of this entry, GetDialogBaseUnits is a crock. Since there is no HWND parameter to GetDialogBaseUnits, it doesn't know which dialog box's DLUs you want to retrieve. So it guesses.</p> <p>And it always guesses wrong.</p> <p>GetDialogBaseUnits returns the dialog base units for dialog boxes that use the default system font. But nobody uses the default system font any more. It screams "old and dorky". But it remains the default for compatibility reasons. (And therefore so too does GetDialogBaseUnits.)</p> </blockquote> <p>If you have to calculate pixel dimensions from DLUs, and you don't have a handle to a dialog, then you must use the method outlined here: <a href="http://support.microsoft.com/kb/125681">How To Calculate Dialog Base Units with Non-System-Based Font</a></p> <hr> <p>However, you made it clear in the comments that, for your problem, you do not actually need to convert from DLUs to pixels. You can use Delphi's built in form scaling to ensure that your forms are sized appropriately for the prevailing font scaling.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload