Skip to main content

TdxScaleFactor.Apply(TSize,Integer,Integer) Method

Applies the current or modified scaling factor to the specified value.

Declaration

function Apply(const V: TSize; ASourceNumerator: Integer; ASourceDenominator: Integer): TSize; overload;

Parameters

Name Type
V TSize
ASourceNumerator Integer
ASourceDenominator Integer

Returns

Type
TSize

Remarks

Call this function to multiply and divide a value passed as the V parameter, by the Numerator and Denominator property values, respectively. The first five overloaded variants allow you to apply the unmodified current scaling factor as is to different value types:

Overloaded Variant Description
1 Multiplies the numerator by the specified integer value and divides the product by the denominator rounding the returned value to the nearest integer.
2 Multiplies both the X and Y fields of the specified TPoint record by the numerator and then divides each product by the denominator rounding the returned record’s both field values to the nearest integer.
3 Multiplies the Left, Top, Right, and Bottom fields of the specified TRect record by the numerator and then divides each product by the denominator rounding the returned record’s field values to the nearest integer.
4 Multiplies both the cx and cy fields of the specified TSize record by the numerator and then divides each product by the denominator rounding both of the returned record’s field values to the nearest integer.
5 This function variant, named ApplyF, due to C++Builder compiler limitations, multiplies the numerator by the specified floating-point value and divides the product by the denominator. Unlike the other overloaded function variants that accept a single parameter, ApplyF does not round the returned value.

You can call the corresponding overloaded Revert (or RevertF) function variant to perform the reverse operation.

The last eight overloaded Apply function variants are useful for scaling the visual elements designed for a specific target DPI. These variants multiply the specified value by the actual scaling factor calculated as the current scaling factor divided by the source scaling factor that corresponds to the target DPI. Particular function variants accept the source scaling factor either as a TdxScaleFactor object passed as the ASourceScaleFactor parameter or as the two individual numerator and denominator integer values passed as the ASourceNumerator and ASourceDenominator parameters, respectively:

Overloaded Variant

Accepts the Source Scaling Factor as

Description

6

Another TdxScaleFactor object.

Applies the actual scaling factor to the specified integer value, similar to the first (1) overloaded Apply function variant.

10

Two individual numerator and denominator integer values.

7

Another TdxScaleFactor object.

Applies the actual scaling factor to the specified TPoint record, similar to the second (2) overloaded function variant.

11

Two individual numerator and denominator integer values.

8

Another TdxScaleFactor object.

Applies the actual scaling factor to the specified TRect record, similar to the third (3) overloaded function variant.

12

Two individual numerator and denominator integer values.

9

Another TdxScaleFactor object.

Applies the actual scaling factor to the specified TSize record, similar to the fourth (4) overloaded function variant.

13

Two individual numerator and denominator integer values.

These overloaded variants do not have Revert function counterparts.

See Also