mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 17:49:28 +02:00
lcl: TControl: add ScaleCoord96 and -Back for 96 PPI
git-svn-id: trunk@53571 -
This commit is contained in:
parent
f49912d641
commit
4a214df8bf
lcl
@ -1478,6 +1478,8 @@ type
|
||||
//scale support
|
||||
function ScaleCoord(const ASize: Integer): Integer;
|
||||
function ScaleCoordBack(const ASize: Integer): Integer;
|
||||
function ScaleCoord96(const ASize: Integer): Integer;
|
||||
function ScaleCoord96Back(const ASize: Integer): Integer;
|
||||
public
|
||||
// size
|
||||
procedure AdjustSize; virtual;// smart calling DoAutoSize
|
||||
|
@ -778,6 +778,34 @@ begin
|
||||
Result := MulDiv(ASize, ParentForm.PixelsPerInch, ParentForm.DesignTimeDPI);
|
||||
end;
|
||||
|
||||
function TControl.ScaleCoord96(const ASize: Integer): Integer;
|
||||
var
|
||||
ParentForm: TCustomForm;
|
||||
begin
|
||||
ParentForm := GetParentForm(Self);
|
||||
if ParentForm=nil then
|
||||
raise EInvalidOperation.CreateFmt(rsControlHasNoParentForm, [Name]);
|
||||
|
||||
if ParentForm.PixelsPerInch=96 then
|
||||
Result := ASize
|
||||
else
|
||||
Result := MulDiv(ASize, ParentForm.PixelsPerInch, 96);
|
||||
end;
|
||||
|
||||
function TControl.ScaleCoord96Back(const ASize: Integer): Integer;
|
||||
var
|
||||
ParentForm: TCustomForm;
|
||||
begin
|
||||
ParentForm := GetParentForm(Self);
|
||||
if ParentForm=nil then
|
||||
raise EInvalidOperation.CreateFmt(rsControlHasNoParentForm, [Name]);
|
||||
|
||||
if ParentForm.PixelsPerInch=96 then
|
||||
Result := ASize
|
||||
else
|
||||
Result := MulDiv(ASize, 96, ParentForm.PixelsPerInch);
|
||||
end;
|
||||
|
||||
function TControl.ScaleCoordBack(const ASize: Integer): Integer;
|
||||
var
|
||||
ParentForm: TCustomForm;
|
||||
|
Loading…
Reference in New Issue
Block a user