OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Layout Units

You can use three different units of measurement in a gadget window:

  • Pixels, which are based on a single screen pixel
  • Layout units, which are logical units defined by dividing the window font "em" into 8 vertical and 8 horizontal segments.
  • Border units, which are based on the thickness of a window frame. A border unit is usually equivalent to one pixel, but it could be greater at higher screen resolutions.

It is usually best to use layout units. Because they are based on the font size, you do not have to worry about scaling your measures when you change window size or system metrics.

If you need to convert layout units to pixels, use the TGadgetWindow::LayoutUnitsToPixels function:

int LayoutUnitsToPixels(int units);

The units parameter is the layout unit measure you want to convert to pixels. LayoutUnitsToPixels returns the pixel equivalent of units.

You can also convert a TMargins object to actual pixel measurements using the GetMargins function:

void GetMargins(TMargins& margins,
int& left,
int& right,
int& top,
int& bottom);
  • margins is the object containing the measurements you want to convert. The measurements contained in margins can be in pixels, layout units, or border units.
  • left, right, top, and bottom are the results of the conversion in pixels.