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 object ImageList1: TImageList
Scaled = True Scaled = True
OnGetWidthForPPI = ImageList1GetWidthForPPI OnGetWidthForPPI = ImageList1GetWidthForPPI
left = 24 Left = 24
top = 296 Top = 296
Bitmap = { Bitmap = {
4C69050000001000000010000000000000000000000078483671784836FE7848 4C69050000001000000010000000000000000000000078483671784836FE7848
36FD784836FD784836FD784836FC784836FC794937E55EACB1084FE9FC2F53E9 36FD784836FD784836FD784836FC784836FC794937E55EACB1084FE9FC2F53E9
@ -1338,8 +1338,8 @@ object Form1: TForm1
end end
object MainMenu1: TMainMenu object MainMenu1: TMainMenu
Images = ImageList1 Images = ImageList1
left = 64 Left = 64
top = 296 Top = 296
object MenuItem1: TMenuItem object MenuItem1: TMenuItem
Caption = 'MenuItem1' Caption = 'MenuItem1'
SubMenuImages = ImageList1 SubMenuImages = ImageList1

View File

@ -45,10 +45,11 @@ implementation
{ TForm1 } { TForm1 }
// Sharing the same ImageList for SmallImages and LargeImages of a ListView
procedure TForm1.ImageList1GetWidthForPPI(Sender: TCustomImageList; procedure TForm1.ImageList1GetWidthForPPI(Sender: TCustomImageList;
AImageWidth, APPI: Integer; var AResultWidth: Integer); AImageWidth, APPI: Integer; var AResultWidth: Integer);
begin begin
// make sure that the originally available resolutions (22px and 32px)
// are used if 20-24px or 30-36px are needed
case AResultWidth of case AResultWidth of
20..24: AResultWidth := 22; 20..24: AResultWidth := 22;
30..36: AResultWidth := 32; 30..36: AResultWidth := 32;
@ -58,8 +59,8 @@ end;
procedure TForm1.RadioGroup1Click(Sender: TObject); procedure TForm1.RadioGroup1Click(Sender: TObject);
begin begin
case Radiogroup1.ItemIndex of case Radiogroup1.ItemIndex of
0: Listview1.ViewStyle := vsIcon; 0: ListView1.ViewStyle := vsIcon;
1: Listview1.ViewStyle := vsSmallIcon; 1: ListView1.ViewStyle := vsSmallIcon;
end; end;
end; end;