From 33852710ce1580c99b2e624c28c6d156f3819bfb Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 9 Nov 2007 04:09:30 +0000 Subject: [PATCH] new imagelist state drawing example git-svn-id: trunk@12793 - --- .gitattributes | 7 + examples/imagelist/images/edit-clear.png | Bin 0 -> 1682 bytes .../imagelist/images/edit-find-replace.png | Bin 0 -> 2104 bytes examples/imagelist/project1.lpi | 295 ++++++++++++++++++ examples/imagelist/project1.lpr | 18 ++ examples/imagelist/unit1.lfm | 151 +++++++++ examples/imagelist/unit1.lrs | 52 +++ examples/imagelist/unit1.pas | 128 ++++++++ 8 files changed, 651 insertions(+) create mode 100644 examples/imagelist/images/edit-clear.png create mode 100644 examples/imagelist/images/edit-find-replace.png create mode 100644 examples/imagelist/project1.lpi create mode 100644 examples/imagelist/project1.lpr create mode 100644 examples/imagelist/unit1.lfm create mode 100644 examples/imagelist/unit1.lrs create mode 100644 examples/imagelist/unit1.pas diff --git a/.gitattributes b/.gitattributes index d759f7f7fc..20f74dfd8b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1526,6 +1526,13 @@ examples/htmlhelp_ipro/htmlhelpsample.lpr svneol=native#text/plain examples/idequickfix/quickfixdemo1.pas svneol=native#text/plain examples/idequickfix/quickfixexample.lpk svneol=native#text/plain examples/idequickfix/quickfixexample.pas svneol=native#text/plain +examples/imagelist/images/edit-clear.png -text svneol=unset#image/png +examples/imagelist/images/edit-find-replace.png -text svneol=unset#image/png +examples/imagelist/project1.lpi svneol=native#text/plain +examples/imagelist/project1.lpr svneol=native#text/plain +examples/imagelist/unit1.lfm svneol=native#text/plain +examples/imagelist/unit1.lrs svneol=native#text/pascal +examples/imagelist/unit1.pas svneol=native#text/pascal examples/imgviewer/file.bmp -text svneol=native#image/bmp examples/imgviewer/file.xpm -text svneol=native#image/x-xpixmap examples/imgviewer/frmmain.lfm svneol=native#text/plain diff --git a/examples/imagelist/images/edit-clear.png b/examples/imagelist/images/edit-clear.png new file mode 100644 index 0000000000000000000000000000000000000000..5542948bca68a69ee870e7a52d03116319dde91d GIT binary patch literal 1682 zcmV;D25tF?P)=WF&{CV_9@n0EH~>m$0VH$B=#W-b8Il^pX+x7^ugKXTx^D5^$D zMUAwuzHwpT!~Ry#e=`>Vv2b7*rdN&zvAD{3@TrT)(J|^9*E1;?j4U?T}A}A5d;j1y_L4G z|MJo|&zdjHDd4R>f}d$JgbDxo)lC~)t*KBS+2|0Zi z(FWtElcAAw7fv41N*1p}Q!>cG0TxtM*_;mH2k-vY{`}uNFgrW1#Lu>b=}!K9J2e)I zrN8C&jczkDPC6dKRv}_5nP5S~dL=UQ4~vmbF1ceD!*c=v_~nC^2dob3OE=%Tu*hB- z#67Qu`W3A}8LzZ|U%7BNmQYo*eINW`P5`~HurwnJ$BVq)%7&F+z+1756R-C0#-5|p zIg40eh#Uz7WDRQfLv*$PX}Xg=9em3$#Ag=XbfaFm=r)3VVfOES4Jl#L-m)66DB|<^ zaD>BRTGv~EKhG90Z34#*uu(KPA_&#S`yHBn z>R|>9N_kA1^{5-S2J-#RYB8abafIzNMdL?vZ*vmR>#yc6nX2J9C@2;qDQD- z{kW&d-SE!wm-*r~0}O!=(}_q{)9j>@2@o=*6G2MKi-`n+xIA8xF%5(W?uuq6hK~{t zbyBx-x2vRj^9#KPc(Jz==d1w&{3|1ebwluwk`ow)LLxejMN%j#aT6Z(;qp`?M^c#D zC}lNkiTeJ@*x-H^-t>T@`qpo@idyl=@ea1m3UJ2|16ocNG&My|wV~vaC`yiGJW6R* z9f=7UiOe%Vjd5c#ej|r%m zFfPv;iYu0*XXCk`ufJo{Lp<5vj}veLHbA(V1gwCqyBGhq&FNj9$_BS#cu|$hSRHl9 z69F6^4^B@lp~2IXRX5=9G!q@YOe%g}30-tG3-!#G71UZu_0RR9107*qoM6N<$f|8{*)Bpeg literal 0 HcmV?d00001 diff --git a/examples/imagelist/images/edit-find-replace.png b/examples/imagelist/images/edit-find-replace.png new file mode 100644 index 0000000000000000000000000000000000000000..0f1b117ff791666419bc589726ef043d30a2664e GIT binary patch literal 2104 zcmV-82*>w{P)Stz+8LL@I&?aY{^5+Yag<6sg41zCtwU!hHUmu62t*{?GlYb^ycY<0$;O+F=+*mLy4>K7ATVk}ypZx7$rT9>+g8Krk2}JRZg{ zbnJFJIXStMl`bPECl^V&Oi%!X5ai_KpzC_p6#;}0=l_i)rF>{8$j7Z8QC(Bb_Zu6@ z%JiTrDw?hl3XRbE=_hpgI$2rYfXn5+3}7y>Sph7|ngI|T3eeTv!H@6%39{;B&w(!X zANz>maE#LY4DPzAhz)l%F&G%&gAd-PeEA9-4hH~=qOfe)vN?la5g-WxGEa8)_Kd0-`qEHNC8bMUyIzZ}@d&L?i8v2iUeEiK&Hv~kw2zM$^KCeH?N z;la+%c5c4;79t73b8jB!`7I5sxvqfh3_C8ngx6zdLqjoj6}de8Vhcq@CD@&I4jn#( z&*$Uh$&)E1uNuHK%~U%W^s}sNIWPR}1P|X)Ly6aeJIz6w!%mvRfh)~Py4yu*VK#+% z^V$FDDb}oBLpVIjiWMs;FE9V^0m9>9JXu*xMH6%lj8p2(B$m*KC6Z{GhNdOalX0e} zr&)MS#n4Af4=u#-dbJRb3YBYXR6D4&sS8s%#R8X^c)K5T=fVg(L*A zc$~ALapFlGQ%DR?Xrw!3!r>4I=Dh>I8?C97Lp`!YB))I?-;K<{w@Bz^Ho-qSJTnafvT!xd(wFG#Vs_h`xPtj zz`lJf{HPUso+yAhlCZO@gMYPrNOe^WX-+3)ML9fke+>tY1_+J|+?m7K0^3(Gj>a$$Vm}X9HHjBK4ghHbTA*j3lT8au6qu8A6Ind4iV`n%Uj!~AM!4Db=Xu7qMuC5N6 zUv1{jrj58=Zu(CAlVJNh+tPD%&^!4{qS64?(%{46WEI?6Jw4_FGXpndI?nO%`+5F(c zWM*dak3GL9)U%(p-&=(~6(BPFITK+UNBZ0Z!ac9&-7x*=wryA`1-5VB?v+)sfAQkt zYKJY2zP>&bMWLjmglKFEUDx@}>hIEjx{r>|b^?I_kw^rm)5+4(G8$Gkuw+RomT9p2 zytS`whUzMSqVmdhb#>Lkk~n(g7#@#@{QP`E z;StgtPHy`4tt1i&qLCOy1;s2bEJ2oKBuPS16waL+VJJArC+|Mb^%YrESJe|abCkqn z5MLm{7omCF_t*}edj93v*8w5Kn&r!v6OBiRMk|mciNT;BRaU9HrjB?#j;`zE=H>$D z3zf}g!)CJ~%QCU)QQmF-Ew|T~P*AXlslk7fh>UT(KgpSRHjg~J8*kxKU=9Fe4)yo< zuU}GHN|q;+_VyE0SJjg5T|_({N0wz2MWMI17sD`66eacb(_?;ohyKLfjW?2+;bd~) zAdyIfW2bZ`C}8U!-pA=mzbxodXBfyb>uZ3*ti;-h%z~Fi11XBwgCxG@oFC3`bT70nRN-C0r2FL+k!w7 zz@|-`L|$$l;cys9l2BC@m&=7|n)rM^Ow&Y?Bq9?de6n{to9=7Gm<%vAe1hPpM%#c) zVeNXV8t$XBvy0l=+A9NGY=&XXIiRw#GNr)l+wWz=JsU}{yoIqNuW@oHLD#U0rbk|& zwtg*ezW4|szTTGX!csh&b$54TnkHulPM{hga`Ow&Cj5NipW^c&H>>V_j+z@9=N$iy z0V*pi5yGNn_pe#CZW9OJ+f83!isjed&J!=aL3-wbuax^60|4yZ`3(K1dSKrk>TiFD z`XAkfWeG+`CpZ@xPbKJuX==0CQh9VW02#6@PYEG1GBPq!=K@t#5kg>^2JUnZzkBs# zvb`lUPC}RNrWHj&RaF#4K~WTBS;lU+PXl?tIFN*y#V8%fsjsiUySTXcSxJ)8u2RLT zwM1`k?+a~hZSMgiz*)e$7{CGK01JSuFYlHARdCL$9R`5S%ss90euKkcGS-)fe0000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/imagelist/project1.lpr b/examples/imagelist/project1.lpr new file mode 100644 index 0000000000..5f76875bbf --- /dev/null +++ b/examples/imagelist/project1.lpr @@ -0,0 +1,18 @@ +program project1; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms + { you can add units after this }, Unit1; + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/examples/imagelist/unit1.lfm b/examples/imagelist/unit1.lfm new file mode 100644 index 0000000000..658443551b --- /dev/null +++ b/examples/imagelist/unit1.lfm @@ -0,0 +1,151 @@ +object Form1: TForm1 + Left = 290 + Height = 334 + Top = 175 + Width = 628 + HorzScrollBar.Page = 627 + VertScrollBar.Page = 333 + ActiveControl = ListBox1 + Caption = 'Form1' + ClientHeight = 334 + ClientWidth = 628 + OnCreate = FormCreate + object ListBox1: TListBox + AnchorSideLeft.Control = GroupBox1 + AnchorSideTop.Control = GroupBox1 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = GroupBox4 + AnchorSideRight.Side = asrBottom + Left = 20 + Height = 120 + Top = 166 + Width = 588 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Top = 10 + OnSelectionChange = ListBox1SelectionChange + TabOrder = 0 + end + object GroupBox1: TGroupBox + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = Owner + Left = 20 + Height = 146 + Top = 10 + Width = 132 + AutoSize = True + BorderSpacing.Left = 20 + BorderSpacing.Top = 10 + Caption = 'Normal' + ClientHeight = 128 + ClientWidth = 128 + Color = clWhite + ParentColor = False + TabOrder = 1 + object Image1: TImage + AnchorSideTop.Side = asrBottom + Height = 128 + Width = 128 + Center = True + Transparent = False + end + end + object GroupBox2: TGroupBox + AnchorSideLeft.Control = GroupBox1 + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Owner + Left = 172 + Height = 146 + Top = 10 + Width = 132 + AutoSize = True + BorderSpacing.Left = 20 + BorderSpacing.Top = 10 + Caption = 'Disabled' + ClientHeight = 128 + ClientWidth = 128 + Color = clWhite + ParentColor = False + TabOrder = 2 + object Image2: TImage + AnchorSideTop.Side = asrBottom + Height = 128 + Width = 128 + Center = True + Transparent = False + end + end + object GroupBox3: TGroupBox + AnchorSideLeft.Control = GroupBox2 + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Owner + Left = 324 + Height = 146 + Top = 10 + Width = 132 + AutoSize = True + BorderSpacing.Left = 20 + BorderSpacing.Top = 10 + Caption = 'Highlighted' + ClientHeight = 128 + ClientWidth = 128 + Color = clWhite + ParentColor = False + TabOrder = 3 + object Image3: TImage + AnchorSideTop.Side = asrBottom + Height = 128 + Width = 128 + Center = True + Transparent = False + end + end + object GroupBox4: TGroupBox + AnchorSideLeft.Control = GroupBox3 + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Owner + Left = 476 + Height = 146 + Top = 10 + Width = 132 + AutoSize = True + BorderSpacing.Left = 20 + BorderSpacing.Top = 10 + Caption = 'Shadowed' + ClientHeight = 128 + ClientWidth = 128 + Color = clWhite + ParentColor = False + TabOrder = 4 + object Image4: TImage + AnchorSideTop.Side = asrBottom + Height = 128 + Width = 128 + Center = True + Transparent = False + end + end + object Button1: TButton + AnchorSideTop.Control = ListBox1 + AnchorSideTop.Side = asrBottom + Left = 20 + Height = 25 + Top = 296 + Width = 75 + BorderSpacing.Top = 10 + Caption = 'Add ...' + OnClick = Button1Click + TabOrder = 5 + end + object ImageList1: TImageList + Height = 128 + Width = 128 + left = 384 + top = 192 + end + object OpenPictureDialog1: TOpenPictureDialog + Title = 'Open existing file' + Filter = 'Graphic (*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp)|*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp|Icon (*.ico)|*.ico|Portable PixMap (*.ppm)|*.ppm|Portable GrayMap (*.pgm)|*.pgm|Portable BitMap (*.pbm)|*.pbm|Portable Network Graphic (*.png)|*.png|Pixmap (*.xp' + left = 416 + top = 192 + end +end diff --git a/examples/imagelist/unit1.lrs b/examples/imagelist/unit1.lrs new file mode 100644 index 0000000000..53d557893e --- /dev/null +++ b/examples/imagelist/unit1.lrs @@ -0,0 +1,52 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TForm1','FORMDATA',[ + 'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'"'#1#6'Height'#3'N'#1#3'Top'#3#175#0#5'Wi' + +'dth'#3't'#2#18'HorzScrollBar.Page'#3's'#2#18'VertScrollBar.Page'#3'M'#1#13 + +'ActiveControl'#7#8'ListBox1'#7'Caption'#6#5'Form1'#12'ClientHeight'#3'N'#1 + +#11'ClientWidth'#3't'#2#8'OnCreate'#7#10'FormCreate'#0#8'TListBox'#8'ListBox' + +'1'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#21'AnchorSideTop.Control'#7#9 + +'GroupBox1'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Control' + +#7#9'GroupBox4'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#20#6'Heigh' + +'t'#2'x'#3'Top'#3#166#0#5'Width'#3'L'#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'a' + +'kRight'#0#17'BorderSpacing.Top'#2#10#17'OnSelectionChange'#7#23'ListBox1Sel' + +'ectionChange'#8'TabOrder'#2#0#0#0#9'TGroupBox'#9'GroupBox1'#22'AnchorSideLe' + +'ft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#2#20#6 + +'Height'#3#146#0#3'Top'#2#10#5'Width'#3#132#0#8'AutoSize'#9#18'BorderSpacing' + +'.Left'#2#20#17'BorderSpacing.Top'#2#10#7'Caption'#6#6'Normal'#12'ClientHeig' + +'ht'#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'clWhite'#11'ParentColor'#8 + +#8'TabOrder'#2#1#0#6'TImage'#6'Image1'#18'AnchorSideTop.Side'#7#9'asrBottom' + +#6'Height'#3#128#0#5'Width'#3#128#0#6'Center'#9#11'Transparent'#8#0#0#0#9'TG' + +'roupBox'#9'GroupBox2'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#19'AnchorSi' + +'deLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#3 + +#172#0#6'Height'#3#146#0#3'Top'#2#10#5'Width'#3#132#0#8'AutoSize'#9#18'Borde' + +'rSpacing.Left'#2#20#17'BorderSpacing.Top'#2#10#7'Caption'#6#8'Disabled'#12 + +'ClientHeight'#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'clWhite'#11'Pare' + +'ntColor'#8#8'TabOrder'#2#2#0#6'TImage'#6'Image2'#18'AnchorSideTop.Side'#7#9 + +'asrBottom'#6'Height'#3#128#0#5'Width'#3#128#0#6'Center'#9#11'Transparent'#8 + +#0#0#0#9'TGroupBox'#9'GroupBox3'#22'AnchorSideLeft.Control'#7#9'GroupBox2'#19 + +'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#5'Owner'#4 + +'Left'#3'D'#1#6'Height'#3#146#0#3'Top'#2#10#5'Width'#3#132#0#8'AutoSize'#9#18 + +'BorderSpacing.Left'#2#20#17'BorderSpacing.Top'#2#10#7'Caption'#6#11'Highlig' + +'hted'#12'ClientHeight'#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'clWhite' + +#11'ParentColor'#8#8'TabOrder'#2#3#0#6'TImage'#6'Image3'#18'AnchorSideTop.Si' + +'de'#7#9'asrBottom'#6'Height'#3#128#0#5'Width'#3#128#0#6'Center'#9#11'Transp' + +'arent'#8#0#0#0#9'TGroupBox'#9'GroupBox4'#22'AnchorSideLeft.Control'#7#9'Gro' + +'upBox3'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#5 + +'Owner'#4'Left'#3#220#1#6'Height'#3#146#0#3'Top'#2#10#5'Width'#3#132#0#8'Aut' + +'oSize'#9#18'BorderSpacing.Left'#2#20#17'BorderSpacing.Top'#2#10#7'Caption'#6 + +#8'Shadowed'#12'ClientHeight'#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'c' + +'lWhite'#11'ParentColor'#8#8'TabOrder'#2#4#0#6'TImage'#6'Image4'#18'AnchorSi' + +'deTop.Side'#7#9'asrBottom'#6'Height'#3#128#0#5'Width'#3#128#0#6'Center'#9#11 + +'Transparent'#8#0#0#0#7'TButton'#7'Button1'#21'AnchorSideTop.Control'#7#8'Li' + +'stBox1'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#20#6'Height'#2#25#3 + +'Top'#3'('#1#5'Width'#2'K'#17'BorderSpacing.Top'#2#10#7'Caption'#6#7'Add ...' + +#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#5#0#0#10'TImageList'#10'ImageLi' + +'st1'#6'Height'#3#128#0#5'Width'#3#128#0#4'left'#3#128#1#3'top'#3#192#0#0#0 + +#18'TOpenPictureDialog'#18'OpenPictureDialog1'#5'Title'#6#18'Open existing f' + +'ile'#6'Filter'#6#255'Graphic (*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp)|*.' + +'ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp|Icon (*.ico)|*.ico|Portable PixMap ' + +'(*.ppm)|*.ppm|Portable GrayMap (*.pgm)|*.pgm|Portable BitMap (*.pbm)|*.pbm|' + +'Portable Network Graphic (*.png)|*.png|Pixmap (*.xp'#4'left'#3#160#1#3'top' + +#3#192#0#0#0#0 +]); diff --git a/examples/imagelist/unit1.pas b/examples/imagelist/unit1.pas new file mode 100644 index 0000000000..cbd3167f63 --- /dev/null +++ b/examples/imagelist/unit1.pas @@ -0,0 +1,128 @@ +unit Unit1; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, LResources, Forms, Controls, Graphics, GraphType, Dialogs, ExtCtrls, + StdCtrls, ExtDlgs; + +type + + { TForm1 } + + TForm1 = class(TForm) + Button1: TButton; + GroupBox1: TGroupBox; + GroupBox2: TGroupBox; + GroupBox3: TGroupBox; + GroupBox4: TGroupBox; + Image1: TImage; + Image2: TImage; + Image3: TImage; + Image4: TImage; + ImageList1: TImageList; + ListBox1: TListBox; + OpenPictureDialog1: TOpenPictureDialog; + procedure Button1Click(Sender: TObject); + procedure FormCreate(Sender: TObject); + function GetImageMap(AEffect: TGraphicsDrawEffect): TImage; + procedure ListBox1SelectionChange(Sender: TObject; User: boolean); + private + { private declarations } + public + procedure ShowImages(AIndex: Integer); + procedure AddFile(AFileName: String); + property ImageMap[AEffect: TGraphicsDrawEffect]: TImage read GetImageMap; + end; + +var + Form1: TForm1; + +implementation + +{ TForm1 } + +function LoadBitmapFromFile(AFileName: String): TBitmap; +var + Stream: TStream; + GraphicClass: TGraphicClass; +begin + Result := nil; + Stream := nil; + try + Stream := TFileStream.Create(AFileName, fmOpenRead or fmShareDenyNone); + GraphicClass := GetGraphicClassForFileExtension(ExtractFileExt(AFileName)); + if (GraphicClass <> nil) and (GraphicClass.InheritsFrom(TBitmap)) then + begin + Result := TBitmap(GraphicClass.Create); + Result.LoadFromStream(Stream); + end; + finally + Stream.Free; + end; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + AddFile(ExtractFilePath(ParamStr(0)) + 'images\edit-clear.png'); + AddFile(ExtractFilePath(ParamStr(0)) + 'images\edit-find-replace.png'); +end; + +procedure TForm1.Button1Click(Sender: TObject); +begin + if OpenPictureDialog1.Execute then + AddFile(OpenPictureDialog1.FileName); +end; + +function TForm1.GetImageMap(AEffect: TGraphicsDrawEffect): TImage; +begin + case AEffect of + gdeNormal: Result := Image1; + gdeDisabled: Result := Image2; + gdeHighlighted: Result := Image3; + gdeShadowed: Result := Image4; + end; +end; + +procedure TForm1.ListBox1SelectionChange(Sender: TObject; User: boolean); +begin + if ListBox1.ItemIndex <> -1 then + ShowImages(ListBox1.ItemIndex); +end; + +procedure TForm1.ShowImages(AIndex: Integer); +var + AEffect: TGraphicsDrawEffect; + Bmp: TBitmap; +begin + for AEffect := Low(TGraphicsDrawEffect) to High(TGraphicsDrawEffect) do + begin + Bmp := TBitmap.Create; + ImageList1.GetBitmap(AIndex, Bmp, AEffect); + ImageMap[AEffect].Picture.Assign(Bmp); + Bmp.Free; + end; +end; + +procedure TForm1.AddFile(AFileName: String); +var + bmp: TBitmap; +begin + bmp := LoadBitmapFromFile(AFileName); + if bmp <> nil then + begin + ImageList1.Add(bmp, nil); + ListBox1.Items.Add(ExtractFileName(AFileName)); + if ListBox1.ItemIndex = -1 then + ListBox1.ItemIndex := 0; + end; + bmp.Free; +end; + +initialization + {$I unit1.lrs} + +end. +