<< Click to display table of contents >> TRVStyleUnits |
Unit [VCL/FMX]: RVStyle/fmxRVStyle.
type
TRVStyleUnits = (rvstuPixels, rvstuTwips, rvstuEMU);
This type is used to identify measure units that used internally in a program.
Value |
Meaning |
---|---|
rvstuPixels |
Pixels. 1 pixel = 1/TRVStyle.UnitsPixelsPerInch of an inch (normally, 1/96 of an inch) |
rvstuTwips |
Twips. 1 twip = 1/20 of a point = 1/1440 of an inch |
rvstuEMU |
English metric units. 1 EMU = 1/914400 of an inch = 1/36000 mm |
Values measured in TRVUnits have type TRVStyleLength.
This is a type of TRVStyle.Units. If it is equal to rvstuPixels, values are measured in pixels with DPI specified in TRVStyle.UnitsPixelsPerInch; when rendering on a device (screen or printer), lengths are recalculated according to the device DPI:
<length on device> = <value measured in TRVStyleUnits> * <device DPI> div UnitsPixelsPerInch.
If you do not change value of UnitsPixelsPerInch, pixels are absolute measure units: lengths measured in them do not depend on the device DPI (like twips and EMUs).
However, if you always assign Screen.PixelsPerInch to UnitsPixelsPerInch, pixels become relative units (actual lengths of sizes measured in pixels depend on the screen DPI).
The table below shows how values measured in standard units are converted to various TRVStyleUnits.
Sample Value |
Pixels (DPI = 96) |
Twips |
EMUs |
---|---|---|---|
1 inch |
96 |
1440 |
914400 |
1 mm |
≈ 3.78 |
≈ 56.69 |
36000 |
1 point |
≈ 1.33 |
20 |
12700 |
1 pixel (DPI = 96) |
1 |
15 |
9525 |
It's recommended to use rvstuPixels if sizes are displayed to users as pixels as well. Otherwise, it's recommended to use twips or EMUs.
Twips are OK if sizes are displayed as inches or points, and you do not need precision higher than 0.1.
EMUs are OK in all cases. They provide precision 0.01 for inches and points, 0.001 for mm, 1 for pixels.
See also: