graphics.pas中的原型function TFont.GetSize: Integer;
begin
Result := -MulDiv(Height, 72, FPixelsPerInch);
end;procedure TFont.SetSize(Value: Integer);
begin
Height := -MulDiv(Value, FPixelsPerInch, 72);
end;Delphi已经用MulDiv这个函数取了整,所以没办法设置TFont的Size为非整形参考:
MulDiv
The MulDiv function multiplies two 32-bit values and then divides the 64-bit result by a third 32-bit value. The return value is rounded up or down to the nearest integer. int MulDiv(
int nNumber, // 32-bit signed multiplicand
int nNumerator, // 32-bit signed multiplier
int nDenominator // 32-bit signed divisor
);
Parameters
nNumber
[in] Specifies the multiplicand.
nNumerator
[in] Specifies the multiplier.
nDenominator
[in] Specifies the number by which the result of the multiplication (nNumber * nNumerator) is to be divided.
Return Values
If the function succeeds, the return value is the result of the multiplication and division. If either an overflow occurred or nDenominator was 0, the return value is –1.
begin
Result := -MulDiv(Height, 72, FPixelsPerInch);
end;procedure TFont.SetSize(Value: Integer);
begin
Height := -MulDiv(Value, FPixelsPerInch, 72);
end;Delphi已经用MulDiv这个函数取了整,所以没办法设置TFont的Size为非整形参考:
MulDiv
The MulDiv function multiplies two 32-bit values and then divides the 64-bit result by a third 32-bit value. The return value is rounded up or down to the nearest integer. int MulDiv(
int nNumber, // 32-bit signed multiplicand
int nNumerator, // 32-bit signed multiplier
int nDenominator // 32-bit signed divisor
);
Parameters
nNumber
[in] Specifies the multiplicand.
nNumerator
[in] Specifies the multiplier.
nDenominator
[in] Specifies the number by which the result of the multiplication (nNumber * nNumerator) is to be divided.
Return Values
If the function succeeds, the return value is the result of the multiplication and division. If either an overflow occurred or nDenominator was 0, the return value is –1.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货