examples: imagelist: fix comment, cleanup

git-svn-id: trunk@57292 -
This commit is contained in:
ondrej 2018-02-12 20:24:59 +00:00
parent 017493f462
commit 2f4595ff71
2 changed files with 10 additions and 9 deletions

View File

@ -117,8 +117,8 @@ object Form1: TForm1
object ImageList1: TImageList
Scaled = True
OnGetWidthForPPI = ImageList1GetWidthForPPI
left = 24
top = 296
Left = 24
Top = 296
Bitmap = {
4C69050000001000000010000000000000000000000078483671784836FE7848
36FD784836FD784836FD784836FC784836FC794937E55EACB1084FE9FC2F53E9
@ -1338,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

@ -45,21 +45,22 @@ 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
// make sure that the originally available resolutions (22px and 32px)
// are used if 20-24px or 30-36px are needed
case AResultWidth of
20..24: AResultWidth:=22;
30..36: AResultWidth:=32;
20..24: AResultWidth := 22;
30..36: AResultWidth := 32;
end;
end;
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
case Radiogroup1.ItemIndex of
0: Listview1.ViewStyle := vsIcon;
1: Listview1.ViewStyle := vsSmallIcon;
0: ListView1.ViewStyle := vsIcon;
1: ListView1.ViewStyle := vsSmallIcon;
end;
end;