Examples: Extend imagelist_hidpi_designtime sample to switch between small and large images usage in the listview.

git-svn-id: trunk@57273 -
This commit is contained in:
wp 2018-02-08 15:32:42 +00:00
parent 0a200582f4
commit 0e38359be5
2 changed files with 43 additions and 7 deletions

View File

@ -1,7 +1,7 @@
object Form1: TForm1
Left = 92
Left = 367
Height = 384
Top = 274
Top = 275
Width = 958
Caption = 'Form1'
ClientHeight = 364
@ -89,11 +89,36 @@ object Form1: TForm1
ImageIndex = 0
end
end
object RadioGroup1: TRadioGroup
Left = 324
Height = 47
Top = 297
Width = 304
AutoFill = True
Caption = 'View style'
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 27
ClientWidth = 300
Columns = 2
ItemIndex = 0
Items.Strings = (
'vsIcon'
'vsSmallIcon'
)
OnClick = RadioGroup1Click
TabOrder = 4
end
object ImageList1: TImageList
Scaled = True
OnGetWidthForPPI = ImageList1GetWidthForPPI
Left = 24
Top = 296
left = 24
top = 296
Bitmap = {
4C69050000001000000010000000000000000000000078483671784836FE7848
36FD784836FD784836FD784836FC784836FC794937E55EACB1084FE9FC2F53E9
@ -1313,8 +1338,8 @@ object Form1: TForm1
end
object MainMenu1: TMainMenu
Images = ImageList1
Left = 64
Top = 296
left = 64
top = 296
object MenuItem1: TMenuItem
Caption = 'MenuItem1'
SubMenuImages = ImageList1

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, ImgList,
Menus;
Menus, ExtCtrls;
type
@ -21,6 +21,7 @@ type
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
PageControl1: TPageControl;
RadioGroup1: TRadioGroup;
TabSheet1: TTabSheet;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
@ -28,6 +29,7 @@ type
TreeView1: TTreeView;
procedure ImageList1GetWidthForPPI(Sender: TCustomImageList; AImageWidth,
APPI: Integer; var AResultWidth: Integer);
procedure RadioGroup1Click(Sender: TObject);
private
public
@ -43,6 +45,7 @@ implementation
{ TForm1 }
// Sharing the same ImageList for SmallImages and LargeImages of a ListView
procedure TForm1.ImageList1GetWidthForPPI(Sender: TCustomImageList;
AImageWidth, APPI: Integer; var AResultWidth: Integer);
begin
@ -52,5 +55,13 @@ begin
end;
end;
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
case Radiogroup1.ItemIndex of
0: Listview1.ViewStyle := vsIcon;
1: Listview1.ViewStyle := vsSmallIcon;
end;
end;
end.