examples: update imagelist example - it did not work after TBitmap=>TCustomBitmap change

git-svn-id: trunk@15032 -
This commit is contained in:
paul 2008-05-02 16:04:26 +00:00
parent e1b45f011e
commit 749bbc330b
3 changed files with 56 additions and 56 deletions

View File

@ -11,6 +11,7 @@ object Form1: TForm1
ClientWidth = 781
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '0.9.25'
object ListBox1: TListBox
AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = GroupBox1
@ -169,7 +170,6 @@ object Form1: TForm1
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

View File

@ -5,55 +5,55 @@ LazarusResources.Add('TForm1','FORMDATA',[
+'th'#3#13#3#18'HorzScrollBar.Page'#3#12#3#18'VertScrollBar.Page'#3'M'#1#13'A'
+'ctiveControl'#7#8'ListBox1'#7'Caption'#6#5'Form1'#12'ClientHeight'#3'N'#1#11
+'ClientWidth'#3#13#3#8'OnCreate'#7#10'FormCreate'#8'Position'#7#14'poScreenC'
+'enter'#0#8'TListBox'#8'ListBox1'#22'AnchorSideLeft.Control'#7#9'GroupBox1'
+#21'AnchorSideTop.Control'#7#9'GroupBox1'#18'AnchorSideTop.Side'#7#9'asrBott'
+'om'#23'AnchorSideRight.Control'#7#9'GroupBox5'#20'AnchorSideRight.Side'#7#9
+'asrBottom'#4'Left'#2#20#6'Height'#2'x'#3'Top'#3#166#0#5'Width'#3#228#2#7'An'
+'chors'#11#5'akTop'#6'akLeft'#7'akRight'#0#17'BorderSpacing.Top'#2#10#17'OnS'
+'electionChange'#7#23'ListBox1SelectionChange'#8'TabOrder'#2#0#0#0#9'TGroupB'
+'ox'#9'GroupBox1'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Con'
+'trol'#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'Capt'
+'ion'#6#6'Normal'#12'ClientHeight'#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'Ancho'
+'rSideTop.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'GroupBox2'#22'AnchorSideLeft.Control'
+#7#9'GroupBox1'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Cont'
+'rol'#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'BorderSpacing.Left'#2#20#17'BorderSpacing.Top'#2#10#7'Ca'
+'ption'#6#8'Disabled'#12'ClientHeight'#3#128#0#11'ClientWidth'#3#128#0#5'Col'
+'or'#7#7'clWhite'#11'ParentColor'#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'Cen'
+'ter'#9#11'Transparent'#8#0#0#0#9'TGroupBox'#9'GroupBox3'#22'AnchorSideLeft.'
+'Control'#7#9'GroupBox2'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSid'
+'eTop.Control'#7#5'Owner'#4'Left'#3'D'#1#6'Height'#3#146#0#3'Top'#2#10#5'Wid'
+'th'#3#132#0#8'AutoSize'#9#18'BorderSpacing.Left'#2#20#17'BorderSpacing.Top'
+#2#10#7'Caption'#6#11'Highlighted'#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.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'GroupBox4'#22'Anch'
+'orSideLeft.Control'#7#9'GroupBox3'#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'AutoSize'#9#18'BorderSpacing.Left'#2#20#17'BorderSpac'
+'ing.Top'#2#10#7'Caption'#6#8'Shadowed'#12'ClientHeight'#3#128#0#11'ClientWi'
+'dth'#3#128#0#5'Color'#7#7'clWhite'#11'ParentColor'#8#8'TabOrder'#2#4#0#6'TI'
+'mage'#6'Image4'#18'AnchorSideTop.Side'#7#9'asrBottom'#6'Height'#3#128#0#5'W'
+'idth'#3#128#0#6'Center'#9#11'Transparent'#8#0#0#0#7'TButton'#7'Button1'#21
+'AnchorSideTop.Control'#7#8'ListBox1'#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#9'TGroupBox'#9'GroupBox5'#22'AnchorSideLeft.Control'#7#9'GroupBox4'#19'An'
+'chorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#5'Owner'#4'Le'
+'ft'#3't'#2#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#5'1 Bit'#12
+'ClientHeight'#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'clWhite'#11'Pare'
+'ntColor'#8#8'TabOrder'#2#6#0#6'TImage'#6'Image5'#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#10'TImageList'#10'ImageList1'#6'Height'#3#128#0#5'Width'#3#128#0#4'le'
+'ft'#3#128#1#3'top'#3#192#0#0#0#18'TOpenPictureDialog'#18'OpenPictureDialog1'
+#5'Title'#6#18'Open existing file'#6'Filter'#6#255'Graphic (*.ico;*.ppm;*.pg'
+'m;*.pbm;*.png;*.xpm;*.bmp)|*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp|Icon ('
+'*.ico)|*.ico|Portable PixMap (*.ppm)|*.ppm|Portable GrayMap (*.pgm)|*.pgm|P'
+'ortable BitMap (*.pbm)|*.pbm|Portable Network Graphic (*.png)|*.png|Pixmap '
+'(*.xp'#4'left'#3#160#1#3'top'#3#192#0#0#0#0
+'enter'#10'LCLVersion'#6#6'0.9.25'#0#8'TListBox'#8'ListBox1'#22'AnchorSideLe'
+'ft.Control'#7#9'GroupBox1'#21'AnchorSideTop.Control'#7#9'GroupBox1'#18'Anch'
+'orSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#9'GroupBox5'#20
+'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#20#6'Height'#2'x'#3'Top'#3
+#166#0#5'Width'#3#228#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#17'Bor'
+'derSpacing.Top'#2#10#17'OnSelectionChange'#7#23'ListBox1SelectionChange'#8
+'TabOrder'#2#0#0#0#9'TGroupBox'#9'GroupBox1'#22'AnchorSideLeft.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'Bor'
+'derSpacing.Top'#2#10#7'Caption'#6#6'Normal'#12'ClientHeight'#3#128#0#11'Cli'
+'entWidth'#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'TGroupBox'#9'GroupBo'
+'x2'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#19'AnchorSideLeft.Side'#7#9'a'
+'srBottom'#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'BorderSpacing.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'ParentColor'#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'G'
+'roupBox3'#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'Highlighted'#12'ClientHeight'
+#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'clWhite'#11'ParentColor'#8#8'T'
+'abOrder'#2#3#0#6'TImage'#6'Image3'#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'TGro'
+'upBox'#9'GroupBox4'#22'AnchorSideLeft.Control'#7#9'GroupBox3'#19'AnchorSide'
+'Left.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'AutoSize'#9#18'BorderSpa'
+'cing.Left'#2#20#17'BorderSpacing.Top'#2#10#7'Caption'#6#8'Shadowed'#12'Clie'
+'ntHeight'#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'clWhite'#11'ParentCo'
+'lor'#8#8'TabOrder'#2#4#0#6'TImage'#6'Image4'#18'AnchorSideTop.Side'#7#9'asr'
+'Bottom'#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'ListBox1'#18'AnchorSi'
+'deTop.Side'#7#9'asrBottom'#4'Left'#2#20#6'Height'#2#25#3'Top'#3'('#1#5'Widt'
+'h'#2'K'#17'BorderSpacing.Top'#2#10#7'Caption'#6#7'Add ...'#7'OnClick'#7#12
+'Button1Click'#8'TabOrder'#2#5#0#0#9'TGroupBox'#9'GroupBox5'#22'AnchorSideLe'
+'ft.Control'#7#9'GroupBox4'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'Anchor'
+'SideTop.Control'#7#5'Owner'#4'Left'#3't'#2#6'Height'#3#146#0#3'Top'#2#10#5
+'Width'#3#132#0#8'AutoSize'#9#18'BorderSpacing.Left'#2#20#17'BorderSpacing.T'
+'op'#2#10#7'Caption'#6#5'1 Bit'#12'ClientHeight'#3#128#0#11'ClientWidth'#3
+#128#0#5'Color'#7#7'clWhite'#11'ParentColor'#8#8'TabOrder'#2#6#0#6'TImage'#6
+'Image5'#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#10'TImageList'#10'ImageList1'#6'H'
+'eight'#3#128#0#5'Width'#3#128#0#4'left'#3#128#1#3'top'#3#192#0#0#0#18'TOpen'
+'PictureDialog'#18'OpenPictureDialog1'#6'Filter'#6#255'Graphic (*.ico;*.ppm;'
+'*.pgm;*.pbm;*.png;*.xpm;*.bmp)|*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp|Ic'
+'on (*.ico)|*.ico|Portable PixMap (*.ppm)|*.ppm|Portable GrayMap (*.pgm)|*.p'
+'gm|Portable BitMap (*.pbm)|*.pbm|Portable Network Graphic (*.png)|*.png|Pix'
+'map (*.xp'#4'left'#3#160#1#3'top'#3#192#0#0#0#0
]);

View File

@ -46,7 +46,7 @@ implementation
{ TForm1 }
function LoadBitmapFromFile(AFileName: String): TBitmap;
function LoadBitmapFromFile(AFileName: String): TCustomBitmap;
var
Stream: TStream;
GraphicClass: TGraphicClass;
@ -56,9 +56,9 @@ begin
try
Stream := TFileStream.Create(AFileName, fmOpenRead or fmShareDenyNone);
GraphicClass := GetGraphicClassForFileExtension(ExtractFileExt(AFileName));
if (GraphicClass <> nil) and (GraphicClass.InheritsFrom(TBitmap)) then
if (GraphicClass <> nil) and (GraphicClass.InheritsFrom(TCustomBitmap)) then
begin
Result := TBitmap(GraphicClass.Create);
Result := TCustomBitmap(GraphicClass.Create);
Result.LoadFromStream(Stream);
end;
finally
@ -114,7 +114,7 @@ end;
procedure TForm1.AddFile(AFileName: String);
var
bmp: TBitmap;
bmp: TCustomBitmap;
begin
bmp := LoadBitmapFromFile(AFileName);
if bmp <> nil then