improve imagelist example:

- protect example from extending effects set
- add image for 1 Bit effect

git-svn-id: trunk@12887 -
This commit is contained in:
paul 2007-11-16 01:50:46 +00:00
parent da0fae1075
commit d91f29e289
3 changed files with 80 additions and 42 deletions

View File

@ -1,25 +1,25 @@
object Form1: TForm1 object Form1: TForm1
Left = 290 Left = 265
Height = 334 Height = 334
Top = 175 Top = 150
Width = 628 Width = 781
HorzScrollBar.Page = 627 HorzScrollBar.Page = 780
VertScrollBar.Page = 333 VertScrollBar.Page = 333
ActiveControl = ListBox1 ActiveControl = ListBox1
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 334 ClientHeight = 334
ClientWidth = 628 ClientWidth = 781
OnCreate = FormCreate OnCreate = FormCreate
object ListBox1: TListBox object ListBox1: TListBox
AnchorSideLeft.Control = GroupBox1 AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = GroupBox1 AnchorSideTop.Control = GroupBox1
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GroupBox4 AnchorSideRight.Control = GroupBox5
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 20 Left = 20
Height = 120 Height = 120
Top = 166 Top = 166
Width = 588 Width = 740
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 10 BorderSpacing.Top = 10
OnSelectionChange = ListBox1SelectionChange OnSelectionChange = ListBox1SelectionChange
@ -136,6 +136,31 @@ object Form1: TForm1
OnClick = Button1Click OnClick = Button1Click
TabOrder = 5 TabOrder = 5
end end
object GroupBox5: TGroupBox
AnchorSideLeft.Control = GroupBox4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Owner
Left = 628
Height = 146
Top = 10
Width = 132
AutoSize = True
BorderSpacing.Left = 20
BorderSpacing.Top = 10
Caption = '1 Bit'
ClientHeight = 128
ClientWidth = 128
Color = clWhite
ParentColor = False
TabOrder = 6
object Image5: TImage
AnchorSideTop.Side = asrBottom
Height = 128
Width = 128
Center = True
Transparent = False
end
end
object ImageList1: TImageList object ImageList1: TImageList
Height = 128 Height = 128
Width = 128 Width = 128

View File

@ -1,32 +1,32 @@
{ This is an automatically generated lazarus resource file } { This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[ 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' 'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#9#1#6'Height'#3'N'#1#3'Top'#3#150#0#5'Wid'
+'dth'#3't'#2#18'HorzScrollBar.Page'#3's'#2#18'VertScrollBar.Page'#3'M'#1#13 +'th'#3#13#3#18'HorzScrollBar.Page'#3#12#3#18'VertScrollBar.Page'#3'M'#1#13'A'
+'ActiveControl'#7#8'ListBox1'#7'Caption'#6#5'Form1'#12'ClientHeight'#3'N'#1 +'ctiveControl'#7#8'ListBox1'#7'Caption'#6#5'Form1'#12'ClientHeight'#3'N'#1#11
+#11'ClientWidth'#3't'#2#8'OnCreate'#7#10'FormCreate'#0#8'TListBox'#8'ListBox' +'ClientWidth'#3#13#3#8'OnCreate'#7#10'FormCreate'#0#8'TListBox'#8'ListBox1'
+'1'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#21'AnchorSideTop.Control'#7#9 +#22'AnchorSideLeft.Control'#7#9'GroupBox1'#21'AnchorSideTop.Control'#7#9'Gro'
+'GroupBox1'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Control' +'upBox1'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7
+#7#9'GroupBox4'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#20#6'Heigh' +#9'GroupBox5'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#20#6'Height'
+'t'#2'x'#3'Top'#3#166#0#5'Width'#3'L'#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'a' +#2'x'#3'Top'#3#166#0#5'Width'#3#228#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akR'
+'kRight'#0#17'BorderSpacing.Top'#2#10#17'OnSelectionChange'#7#23'ListBox1Sel' +'ight'#0#17'BorderSpacing.Top'#2#10#17'OnSelectionChange'#7#23'ListBox1Selec'
+'ectionChange'#8'TabOrder'#2#0#0#0#9'TGroupBox'#9'GroupBox1'#22'AnchorSideLe' +'tionChange'#8'TabOrder'#2#0#0#0#9'TGroupBox'#9'GroupBox1'#22'AnchorSideLeft'
+'ft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#2#20#6 +'.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#2#20#6'He'
+'Height'#3#146#0#3'Top'#2#10#5'Width'#3#132#0#8'AutoSize'#9#18'BorderSpacing' +'ight'#3#146#0#3'Top'#2#10#5'Width'#3#132#0#8'AutoSize'#9#18'BorderSpacing.L'
+'.Left'#2#20#17'BorderSpacing.Top'#2#10#7'Caption'#6#6'Normal'#12'ClientHeig' +'eft'#2#20#17'BorderSpacing.Top'#2#10#7'Caption'#6#6'Normal'#12'ClientHeight'
+'ht'#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'clWhite'#11'ParentColor'#8 +#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'clWhite'#11'ParentColor'#8#8'T'
+#8'TabOrder'#2#1#0#6'TImage'#6'Image1'#18'AnchorSideTop.Side'#7#9'asrBottom' +'abOrder'#2#1#0#6'TImage'#6'Image1'#18'AnchorSideTop.Side'#7#9'asrBottom'#6
+#6'Height'#3#128#0#5'Width'#3#128#0#6'Center'#9#11'Transparent'#8#0#0#0#9'TG' +'Height'#3#128#0#5'Width'#3#128#0#6'Center'#9#11'Transparent'#8#0#0#0#9'TGro'
+'roupBox'#9'GroupBox2'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#19'AnchorSi' +'upBox'#9'GroupBox2'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#19'AnchorSide'
+'deLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#3 +'Left.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#3#172
+#172#0#6'Height'#3#146#0#3'Top'#2#10#5'Width'#3#132#0#8'AutoSize'#9#18'Borde' +#0#6'Height'#3#146#0#3'Top'#2#10#5'Width'#3#132#0#8'AutoSize'#9#18'BorderSpa'
+'rSpacing.Left'#2#20#17'BorderSpacing.Top'#2#10#7'Caption'#6#8'Disabled'#12 +'cing.Left'#2#20#17'BorderSpacing.Top'#2#10#7'Caption'#6#8'Disabled'#12'Clie'
+'ClientHeight'#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'clWhite'#11'Pare' +'ntHeight'#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'clWhite'#11'ParentCo'
+'ntColor'#8#8'TabOrder'#2#2#0#6'TImage'#6'Image2'#18'AnchorSideTop.Side'#7#9 +'lor'#8#8'TabOrder'#2#2#0#6'TImage'#6'Image2'#18'AnchorSideTop.Side'#7#9'asr'
+'asrBottom'#6'Height'#3#128#0#5'Width'#3#128#0#6'Center'#9#11'Transparent'#8 +'Bottom'#6'Height'#3#128#0#5'Width'#3#128#0#6'Center'#9#11'Transparent'#8#0#0
+#0#0#0#9'TGroupBox'#9'GroupBox3'#22'AnchorSideLeft.Control'#7#9'GroupBox2'#19 +#0#9'TGroupBox'#9'GroupBox3'#22'AnchorSideLeft.Control'#7#9'GroupBox2'#19'An'
+'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#5'Owner'#4 +'chorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#5'Owner'#4'Le'
+'Left'#3'D'#1#6'Height'#3#146#0#3'Top'#2#10#5'Width'#3#132#0#8'AutoSize'#9#18 +'ft'#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' +'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' +'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' +#11'ParentColor'#8#8'TabOrder'#2#3#0#6'TImage'#6'Image3'#18'AnchorSideTop.Si'
@ -41,12 +41,19 @@ LazarusResources.Add('TForm1','FORMDATA',[
+'Transparent'#8#0#0#0#7'TButton'#7'Button1'#21'AnchorSideTop.Control'#7#8'Li' +'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 +'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 ...' +'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' +#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#5#0#0#9'TGroupBox'#9'GroupBox5'
+'st1'#6'Height'#3#128#0#5'Width'#3#128#0#4'left'#3#128#1#3'top'#3#192#0#0#0 +#22'AnchorSideLeft.Control'#7#9'GroupBox4'#19'AnchorSideLeft.Side'#7#9'asrBo'
+#18'TOpenPictureDialog'#18'OpenPictureDialog1'#5'Title'#6#18'Open existing f' +'ttom'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#3't'#2#6'Height'#3#146#0
+'ile'#6'Filter'#6#255'Graphic (*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp)|*.' +#3'Top'#2#10#5'Width'#3#132#0#8'AutoSize'#9#18'BorderSpacing.Left'#2#20#17'B'
+'ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp|Icon (*.ico)|*.ico|Portable PixMap ' +'orderSpacing.Top'#2#10#7'Caption'#6#5'1 Bit'#12'ClientHeight'#3#128#0#11'Cl'
+'(*.ppm)|*.ppm|Portable GrayMap (*.pgm)|*.pgm|Portable BitMap (*.pbm)|*.pbm|' +'ientWidth'#3#128#0#5'Color'#7#7'clWhite'#11'ParentColor'#8#8'TabOrder'#2#6#0
+'Portable Network Graphic (*.png)|*.png|Pixmap (*.xp'#4'left'#3#160#1#3'top' +#6'TImage'#6'Image5'#18'AnchorSideTop.Side'#7#9'asrBottom'#6'Height'#3#128#0
+#3#192#0#0#0#0 +#5'Width'#3#128#0#6'Center'#9#11'Transparent'#8#0#0#0#10'TImageList'#10'Imag'
+'eList1'#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'
+' file'#6'Filter'#6#255'Graphic (*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp)|'
+'*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp|Icon (*.ico)|*.ico|Portable PixMa'
+'p (*.ppm)|*.ppm|Portable GrayMap (*.pgm)|*.pgm|Portable BitMap (*.pbm)|*.pb'
+'m|Portable Network Graphic (*.png)|*.png|Pixmap (*.xp'#4'left'#3#160#1#3'to'
+'p'#3#192#0#0#0#0
]); ]);

View File

@ -18,10 +18,12 @@ type
GroupBox2: TGroupBox; GroupBox2: TGroupBox;
GroupBox3: TGroupBox; GroupBox3: TGroupBox;
GroupBox4: TGroupBox; GroupBox4: TGroupBox;
GroupBox5: TGroupBox;
Image1: TImage; Image1: TImage;
Image2: TImage; Image2: TImage;
Image3: TImage; Image3: TImage;
Image4: TImage; Image4: TImage;
Image5: TImage;
ImageList1: TImageList; ImageList1: TImageList;
ListBox1: TListBox; ListBox1: TListBox;
OpenPictureDialog1: TOpenPictureDialog; OpenPictureDialog1: TOpenPictureDialog;
@ -83,6 +85,9 @@ begin
gdeDisabled: Result := Image2; gdeDisabled: Result := Image2;
gdeHighlighted: Result := Image3; gdeHighlighted: Result := Image3;
gdeShadowed: Result := Image4; gdeShadowed: Result := Image4;
gde1Bit: Result := Image5;
else
Result := nil;
end; end;
end; end;
@ -101,7 +106,8 @@ begin
begin begin
Bmp := TBitmap.Create; Bmp := TBitmap.Create;
ImageList1.GetBitmap(AIndex, Bmp, AEffect); ImageList1.GetBitmap(AIndex, Bmp, AEffect);
ImageMap[AEffect].Picture.Assign(Bmp); if ImageMap[AEffect] <> nil then
ImageMap[AEffect].Picture.Assign(Bmp);
Bmp.Free; Bmp.Free;
end; end;
end; end;