LCL: forms: highDPI: set DesignTimeDPI automatically by the IDE, don't allow to change it manually.

git-svn-id: trunk@53497 -
This commit is contained in:
ondrej 2016-11-30 23:27:37 +00:00
parent fae72cb0a7
commit 4bccf7cae5
3 changed files with 14 additions and 1 deletions

View File

@ -471,6 +471,7 @@ type
procedure SetAlphaBlend(const AValue: Boolean);
procedure SetAlphaBlendValue(const AValue: Byte);
procedure SetBorderIcons(NewIcons: TBorderIcons);
procedure SetDesignTimeDPI(const aDesignTimeDPI: Integer);
procedure SetFormBorderStyle(NewStyle: TFormBorderStyle);
procedure SetCancelControl(NewControl: TControl);
procedure SetDefaultControl(NewControl: TControl);
@ -659,7 +660,7 @@ type
property DefaultMonitor: TDefaultMonitor read FDefaultMonitor
write FDefaultMonitor default dmActiveForm;
property Designer: TIDesigner read FDesigner write FDesigner;
property DesignTimeDPI: Integer read FDesignTimeDPI write FDesignTimeDPI;
property DesignTimeDPI: Integer read FDesignTimeDPI write SetDesignTimeDPI;
property EffectiveShowInTaskBar: TShowInTaskBar read GetEffectiveShowInTaskBar;
property FormState: TFormState read FFormState;
property FormStyle: TFormStyle read FFormStyle write SetFormStyle
@ -753,6 +754,7 @@ type
property Color;
property Constraints;
property DefaultMonitor;
property DesignTimeDPI;
property DockSite;
property DragKind;
property DragMode;

View File

@ -347,6 +347,14 @@ begin
end;
end;
procedure TCustomForm.SetDesignTimeDPI(const aDesignTimeDPI: Integer);
begin
if not (csLoading in ComponentState) then
raise EInvalidOperation.Create(sCannotSetDesignTimeDPI);
FDesignTimeDPI := aDesignTimeDPI;
end;
{------------------------------------------------------------------------------
Method: TCustomForm.SetIcon
Params: the new icon
@ -2680,6 +2688,8 @@ begin
//DebugLn('TCustomForm.Loaded ',Name,':',ClassName,' ',FormUpdating,' ',fsCreating in FFormState,' ',Visible,' ',fsVisible in FormState);
if fsVisible in FormState then
Visible := True;
if csDesigning in ComponentState then
FDesignTimeDPI := Screen.PixelsPerInch;
end;
{------------------------------------------------------------------------------

View File

@ -217,6 +217,7 @@ resourceString
sInvalidImageSize = 'Invalid image size';
sDuplicateMenus = 'Duplicate menus';
sCannotFocus = 'Cannot focus a disabled or invisible window';
sCannotSetDesignTimeDPI = 'Cannot set design time DPI.';
sParentRequired = 'Control "%s" has no parent window.';
sInvalidCharSet = 'The char set in mask "%s" is not valid!';
SMaskEditNoMatch = 'The current text does not match the specified mask.';