LCL: image list: implement ResolutionForControl

git-svn-id: trunk@57855 -
This commit is contained in:
ondrej 2018-05-08 23:01:35 +00:00
parent 02331cb8e9
commit affd6f7828
3 changed files with 50 additions and 35 deletions

View File

@ -15,31 +15,31 @@ object MenuDesignerForm: TMenuDesignerForm
OnShow = FormShow
Position = poScreenCenter
ShowHint = True
LCLVersion = '1.7'
LCLVersion = '1.9.0.0'
object LeftPanel: TPanel
Left = 0
Height = 400
Top = 0
Width = 219
Width = 204
Align = alLeft
AutoSize = True
ClientHeight = 400
ClientWidth = 219
ClientWidth = 204
Constraints.MinHeight = 345
Constraints.MinWidth = 204
TabOrder = 0
object ButtonsGroupBox: TGroupBox
AnchorSideRight.Side = asrBottom
Left = 7
Height = 104
Height = 98
Top = 7
Width = 205
Width = 190
Align = alTop
AutoSize = True
BorderSpacing.Around = 6
Caption = 'ButtonsGroupBox'
ClientHeight = 78
ClientWidth = 201
ClientWidth = 186
TabOrder = 0
object MoveItemUpButton: TSpeedButton
AnchorSideLeft.Control = ButtonsGroupBox
@ -141,15 +141,15 @@ object MenuDesignerForm: TMenuDesignerForm
object StatisticsGroupBox: TGroupBox
AnchorSideRight.Side = asrBottom
Left = 7
Height = 138
Top = 117
Width = 205
Height = 137
Top = 111
Width = 190
Align = alTop
AutoSize = True
BorderSpacing.Around = 6
Caption = 'StatisticsGroupBox'
ClientHeight = 112
ClientWidth = 201
ClientHeight = 117
ClientWidth = 186
Color = clBtnFace
ParentColor = False
TabOrder = 1
@ -159,9 +159,9 @@ object MenuDesignerForm: TMenuDesignerForm
AnchorSideRight.Control = StatisticsGroupBox
AnchorSideRight.Side = asrBottom
Left = 12
Height = 14
Height = 15
Top = 6
Width = 183
Width = 168
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Around = 6
@ -178,9 +178,9 @@ object MenuDesignerForm: TMenuDesignerForm
AnchorSideRight.Control = StatisticsGroupBox
AnchorSideRight.Side = asrBottom
Left = 12
Height = 14
Top = 26
Width = 183
Height = 15
Top = 27
Width = 168
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Around = 6
@ -197,9 +197,9 @@ object MenuDesignerForm: TMenuDesignerForm
AnchorSideRight.Control = StatisticsGroupBox
AnchorSideRight.Side = asrBottom
Left = 12
Height = 14
Top = 46
Width = 183
Height = 15
Top = 48
Width = 168
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Around = 6
@ -216,9 +216,9 @@ object MenuDesignerForm: TMenuDesignerForm
AnchorSideRight.Control = StatisticsGroupBox
AnchorSideRight.Side = asrBottom
Left = 12
Height = 14
Top = 66
Width = 183
Height = 15
Top = 69
Width = 168
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Around = 6
@ -235,9 +235,9 @@ object MenuDesignerForm: TMenuDesignerForm
AnchorSideRight.Control = StatisticsGroupBox
AnchorSideRight.Side = asrBottom
Left = 12
Height = 14
Top = 86
Width = 183
Height = 15
Top = 90
Width = 168
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Bottom = 6
@ -273,15 +273,15 @@ object MenuDesignerForm: TMenuDesignerForm
AnchorSideRight.Control = LeftPanel
AnchorSideRight.Side = asrBottom
Left = 7
Height = 72
Top = 261
Width = 205
Height = 68
Top = 254
Width = 190
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'RadioItemGroupBox'
ClientHeight = 46
ClientWidth = 201
ClientHeight = 48
ClientWidth = 186
TabOrder = 3
object GroupIndexLabel: TLabel
AnchorSideLeft.Control = RadioItemGroupBox
@ -289,9 +289,9 @@ object MenuDesignerForm: TMenuDesignerForm
AnchorSideRight.Control = RadioItemGroupBox
AnchorSideRight.Side = asrBottom
Left = 12
Height = 14
Height = 15
Top = 6
Width = 183
Width = 168
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Around = 6
@ -305,9 +305,9 @@ object MenuDesignerForm: TMenuDesignerForm
AnchorSideRight.Control = RadioItemGroupBox
AnchorSideRight.Side = asrBottom
Left = 12
Height = 14
Top = 26
Width = 183
Height = 15
Top = 27
Width = 168
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Around = 6

View File

@ -336,6 +336,13 @@ type
{ TDragImageList }
TImageListHelper = class helper for TCustomImageList
private
function GetResolutionForControl(AImageWidth: Integer; AControl: TControl): TScaledImageListResolution;
public
property ResolutionForControl[AImageWidth: Integer; AControl: TControl]: TScaledImageListResolution read GetResolutionForControl;
end;
TDragImageList = class;
TDragImageListResolution = class(TCustomImageListResolution)

View File

@ -281,4 +281,12 @@ begin
RegisterDragImageListResolution;
end;
{ TImageListHelper }
function TImageListHelper.GetResolutionForControl(AImageWidth: Integer;
AControl: TControl): TScaledImageListResolution;
begin
Result := ResolutionForPPI[AImageWidth, AControl.Font.PixelsPerInch, AControl.GetCanvasScaleFactor];
end;
// included by controls.pp