mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 02:39:15 +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
@ -1478,6 +1478,8 @@ type
|
|||||||
//scale support
|
//scale support
|
||||||
function ScaleCoord(const ASize: Integer): Integer;
|
function ScaleCoord(const ASize: Integer): Integer;
|
||||||
function ScaleCoordBack(const ASize: Integer): Integer;
|
function ScaleCoordBack(const ASize: Integer): Integer;
|
||||||
|
function ScaleCoord96(const ASize: Integer): Integer;
|
||||||
|
function ScaleCoord96Back(const ASize: Integer): Integer;
|
||||||
public
|
public
|
||||||
// size
|
// size
|
||||||
procedure AdjustSize; virtual;// smart calling DoAutoSize
|
procedure AdjustSize; virtual;// smart calling DoAutoSize
|
||||||
|
@ -778,6 +778,34 @@ begin
|
|||||||
Result := MulDiv(ASize, ParentForm.PixelsPerInch, ParentForm.DesignTimeDPI);
|
Result := MulDiv(ASize, ParentForm.PixelsPerInch, ParentForm.DesignTimeDPI);
|
||||||
end;
|
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;
|
function TControl.ScaleCoordBack(const ASize: Integer): Integer;
|
||||||
var
|
var
|
||||||
ParentForm: TCustomForm;
|
ParentForm: TCustomForm;
|
||||||
|
Loading…
Reference in New Issue
Block a user