new imagelist state drawing example

git-svn-id: trunk@12793 -
This commit is contained in:
paul 2007-11-09 04:09:30 +00:00
parent 2f279ae0fa
commit 33852710ce
8 changed files with 651 additions and 0 deletions

7
.gitattributes vendored
View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,295 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="6"/>
<General>
<MainUnit Value="0"/>
<TargetFileExt Value=".exe"/>
<ActiveEditorIndexAtStart Value="0"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
<Language Value=""/>
<CharSet Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="3">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="project1"/>
<UsageCount Value="20"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<ComponentName Value="Form1"/>
<IsPartOfProject Value="True"/>
<ResourceFilename Value="unit1.lrs"/>
<UnitName Value="Unit1"/>
<CursorPos X="48" Y="113"/>
<TopLine Value="93"/>
<EditorIndex Value="0"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\..\lcl\graphics.pp"/>
<UnitName Value="Graphics"/>
<CursorPos X="1" Y="1497"/>
<TopLine Value="1476"/>
<EditorIndex Value="1"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit2>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="unit1.pas"/>
<Caret Line="27" Column="29" TopLine="15"/>
</Position1>
<Position2>
<Filename Value="unit1.pas"/>
<Caret Line="17" Column="20" TopLine="15"/>
</Position2>
<Position3>
<Filename Value="unit1.pas"/>
<Caret Line="21" Column="20" TopLine="15"/>
</Position3>
<Position4>
<Filename Value="unit1.pas"/>
<Caret Line="20" Column="20" TopLine="15"/>
</Position4>
<Position5>
<Filename Value="unit1.pas"/>
<Caret Line="19" Column="20" TopLine="15"/>
</Position5>
<Position6>
<Filename Value="unit1.pas"/>
<Caret Line="18" Column="28" TopLine="15"/>
</Position6>
<Position7>
<Filename Value="unit1.pas"/>
<Caret Line="17" Column="26" TopLine="15"/>
</Position7>
<Position8>
<Filename Value="unit1.pas"/>
<Caret Line="18" Column="26" TopLine="15"/>
</Position8>
<Position9>
<Filename Value="unit1.pas"/>
<Caret Line="19" Column="26" TopLine="15"/>
</Position9>
<Position10>
<Filename Value="unit1.pas"/>
<Caret Line="30" Column="71" TopLine="29"/>
</Position10>
<Position11>
<Filename Value="unit1.pas"/>
<Caret Line="78" Column="3" TopLine="64"/>
</Position11>
<Position12>
<Filename Value="unit1.pas"/>
<Caret Line="62" Column="1" TopLine="60"/>
</Position12>
<Position13>
<Filename Value="unit1.pas"/>
<Caret Line="60" Column="1" TopLine="44"/>
</Position13>
<Position14>
<Filename Value="unit1.pas"/>
<Caret Line="28" Column="5" TopLine="22"/>
</Position14>
<Position15>
<Filename Value="unit1.pas"/>
<Caret Line="88" Column="14" TopLine="60"/>
</Position15>
<Position16>
<Filename Value="unit1.pas"/>
<Caret Line="27" Column="30" TopLine="26"/>
</Position16>
<Position17>
<Filename Value="unit1.pas"/>
<Caret Line="26" Column="24" TopLine="26"/>
</Position17>
<Position18>
<Filename Value="unit1.pas"/>
<Caret Line="27" Column="44" TopLine="9"/>
</Position18>
<Position19>
<Filename Value="unit1.pas"/>
<Caret Line="67" Column="35" TopLine="37"/>
</Position19>
<Position20>
<Filename Value="unit1.pas"/>
<Caret Line="89" Column="30" TopLine="73"/>
</Position20>
<Position21>
<Filename Value="unit1.pas"/>
<Caret Line="46" Column="56" TopLine="33"/>
</Position21>
<Position22>
<Filename Value="unit1.pas"/>
<Caret Line="131" Column="5" TopLine="91"/>
</Position22>
<Position23>
<Filename Value="unit1.pas"/>
<Caret Line="87" Column="8" TopLine="78"/>
</Position23>
<Position24>
<Filename Value="unit1.pas"/>
<Caret Line="67" Column="1" TopLine="66"/>
</Position24>
<Position25>
<Filename Value="unit1.pas"/>
<Caret Line="121" Column="28" TopLine="91"/>
</Position25>
<Position26>
<Filename Value="unit1.pas"/>
<Caret Line="120" Column="1" TopLine="91"/>
</Position26>
<Position27>
<Filename Value="unit1.pas"/>
<Caret Line="118" Column="1" TopLine="93"/>
</Position27>
<Position28>
<Filename Value="unit1.pas"/>
<Caret Line="119" Column="1" TopLine="93"/>
</Position28>
<Position29>
<Filename Value="unit1.pas"/>
<Caret Line="121" Column="1" TopLine="93"/>
</Position29>
<Position30>
<Filename Value="unit1.pas"/>
<Caret Line="118" Column="1" TopLine="93"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<BreakPoints Count="15">
<Item1>
<Source Value="..\..\..\laz_svn\win32\RnQ\RnQ.005\viewinfoDlg.pas"/>
<Line Value="238"/>
</Item1>
<Item2>
<Source Value="..\..\..\laz_svn\win32\fpc\2.1.3\source\rtl\inc\wstrings.inc"/>
<Line Value="62"/>
</Item2>
<Item3>
<Source Value="..\..\..\laz_svn\win32\fpc\2.1.3\source\rtl\inc\wstrings.inc"/>
<Line Value="885"/>
</Item3>
<Item4>
<Source Value="..\..\..\laz_svn\win32\RnQ\RnQ.005\ICQv9.pas"/>
<Line Value="2361"/>
</Item4>
<Item5>
<Source Value="..\..\..\laz_svn\win32\RnQ\RnQ.005\RnQ.lpr"/>
<Line Value="116"/>
</Item5>
<Item6>
<Source Value="..\..\..\laz_svn\win32\RnQ\RnQ.005\prefDlg.pas"/>
<Line Value="367"/>
</Item6>
<Item7>
<Source Value="..\..\..\laz_svn\win32\RnQ\For.rnq\RnQGraphics.pas"/>
<Line Value="563"/>
</Item7>
<Item8>
<Source Value="..\..\..\laz_svn\win32\RnQ\For.rnq\RQMenuItem.pas"/>
<Line Value="52"/>
</Item8>
<Item9>
<Source Value="..\..\..\laz_svn\win32\RnQ\For.rnq\RQMenuItem.pas"/>
<Line Value="64"/>
</Item9>
<Item10>
<Source Value="..\..\..\laz_svn\win32\RnQ\For.rnq\RQMenuItem.pas"/>
<Line Value="108"/>
</Item10>
<Item11>
<Source Value="..\..\..\laz_svn\win32\RnQ\RnQ.005\outboxDlg.pas"/>
<Line Value="153"/>
</Item11>
<Item12>
<Source Value="..\..\..\laz_svn\win32\RnQ\RnQ.005\tcpclient.pas"/>
<Line Value="376"/>
</Item12>
<Item13>
<Source Value="..\..\..\laz_svn\win32\RnQ\RnQ.005\chatDlg.pas"/>
<Line Value="550"/>
</Item13>
<Item14>
<Source Value="..\..\..\laz_svn\win32\RnQ\INDY\lazarus\IdThread.pas"/>
<Line Value="584"/>
</Item14>
<Item15>
<Source Value="..\..\..\laz_svn\win32\RnQ\RnQ.005\chatDlg.pas"/>
<Line Value="476"/>
</Item15>
</BreakPoints>
<Watches Count="9">
<Item1>
<Expression Value="Procs"/>
</Item1>
<Item2>
<Expression Value="fn"/>
</Item2>
<Item3>
<Expression Value="ts"/>
</Item3>
<Item4>
<Expression Value="ts.path"/>
</Item4>
<Item5>
<Expression Value="pt.path"/>
</Item5>
<Item6>
<Expression Value="s"/>
</Item6>
<Item7>
<Expression Value="l"/>
</Item7>
<Item8>
<Expression Value="FAddr"/>
</Item8>
<Item9>
<Expression Value="FPort"/>
</Item9>
</Watches>
</Debugging>
</CONFIG>

View File

@ -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.

View File

@ -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

View File

@ -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
]);

View File

@ -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.