Screen.DlgBaseUnitsX (property)

Syntax

Screen.DlgBaseUnitsX

Description

Returns an Integer used to convert horizontal pixels to and from dialog units.

Comments

The number returned depends on the name and size of the font used to display dialog boxes.

To convert from pixels to dialog units in the horizontal direction:

  ((XPixels * 4) + (Screen.DlgBaseUnitsX - 1)) / Screen.DlgBaseUnitsX

To convert from dialog units to pixels in the horizontal direction:

 (XDlgUnits * Screen.DlgBaseUnitsX) / 4

Example

This example converts the screen width from pixels to dialog units.

Sub Main()

  XPixels = Screen.Width

  conv% = Screen.DlgBaseUnitsX

  XDlgUnits = (XPixels * 4) + (conv% -1) / conv%

  MsgBox "The screen width is " & XDlgUnits & " dialog units."

End Sub

See Also

Screen.DlgBaseUnitsY (property).

More information

S