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

View File

@ -336,6 +336,13 @@ type
{ TDragImageList } { 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; TDragImageList = class;
TDragImageListResolution = class(TCustomImageListResolution) TDragImageListResolution = class(TCustomImageListResolution)

View File

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