mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 04:07:57 +02:00
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:
parent
da0fae1075
commit
d91f29e289
@ -1,25 +1,25 @@
|
||||
object Form1: TForm1
|
||||
Left = 290
|
||||
Left = 265
|
||||
Height = 334
|
||||
Top = 175
|
||||
Width = 628
|
||||
HorzScrollBar.Page = 627
|
||||
Top = 150
|
||||
Width = 781
|
||||
HorzScrollBar.Page = 780
|
||||
VertScrollBar.Page = 333
|
||||
ActiveControl = ListBox1
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 334
|
||||
ClientWidth = 628
|
||||
ClientWidth = 781
|
||||
OnCreate = FormCreate
|
||||
object ListBox1: TListBox
|
||||
AnchorSideLeft.Control = GroupBox1
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = GroupBox4
|
||||
AnchorSideRight.Control = GroupBox5
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 20
|
||||
Height = 120
|
||||
Top = 166
|
||||
Width = 588
|
||||
Width = 740
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 10
|
||||
OnSelectionChange = ListBox1SelectionChange
|
||||
@ -136,6 +136,31 @@ object Form1: TForm1
|
||||
OnClick = Button1Click
|
||||
TabOrder = 5
|
||||
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
|
||||
Height = 128
|
||||
Width = 128
|
||||
|
@ -1,32 +1,32 @@
|
||||
{ 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
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#9#1#6'Height'#3'N'#1#3'Top'#3#150#0#5'Wid'
|
||||
+'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'#0#8'TListBox'#8'ListBox1'
|
||||
+#22'AnchorSideLeft.Control'#7#9'GroupBox1'#21'AnchorSideTop.Control'#7#9'Gro'
|
||||
+'upBox1'#18'AnchorSideTop.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'akR'
|
||||
+'ight'#0#17'BorderSpacing.Top'#2#10#17'OnSelectionChange'#7#23'ListBox1Selec'
|
||||
+'tionChange'#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'He'
|
||||
+'ight'#3#146#0#3'Top'#2#10#5'Width'#3#132#0#8'AutoSize'#9#18'BorderSpacing.L'
|
||||
+'eft'#2#20#17'BorderSpacing.Top'#2#10#7'Caption'#6#6'Normal'#12'ClientHeight'
|
||||
+#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'clWhite'#11'ParentColor'#8#8'T'
|
||||
+'abOrder'#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'TGro'
|
||||
+'upBox'#9'GroupBox2'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#19'AnchorSide'
|
||||
+'Left.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'BorderSpa'
|
||||
+'cing.Left'#2#20#17'BorderSpacing.Top'#2#10#7'Caption'#6#8'Disabled'#12'Clie'
|
||||
+'ntHeight'#3#128#0#11'ClientWidth'#3#128#0#5'Color'#7#7'clWhite'#11'ParentCo'
|
||||
+'lor'#8#8'TabOrder'#2#2#0#6'TImage'#6'Image2'#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#9'TGroupBox'#9'GroupBox3'#22'AnchorSideLeft.Control'#7#9'GroupBox2'#19'An'
|
||||
+'chorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#5'Owner'#4'Le'
|
||||
+'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'
|
||||
+'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'
|
||||
@ -41,12 +41,19 @@ LazarusResources.Add('TForm1','FORMDATA',[
|
||||
+'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
|
||||
+#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#5#0#0#9'TGroupBox'#9'GroupBox5'
|
||||
+#22'AnchorSideLeft.Control'#7#9'GroupBox4'#19'AnchorSideLeft.Side'#7#9'asrBo'
|
||||
+'ttom'#21'AnchorSideTop.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'B'
|
||||
+'orderSpacing.Top'#2#10#7'Caption'#6#5'1 Bit'#12'ClientHeight'#3#128#0#11'Cl'
|
||||
+'ientWidth'#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'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
|
||||
]);
|
||||
|
@ -18,10 +18,12 @@ type
|
||||
GroupBox2: TGroupBox;
|
||||
GroupBox3: TGroupBox;
|
||||
GroupBox4: TGroupBox;
|
||||
GroupBox5: TGroupBox;
|
||||
Image1: TImage;
|
||||
Image2: TImage;
|
||||
Image3: TImage;
|
||||
Image4: TImage;
|
||||
Image5: TImage;
|
||||
ImageList1: TImageList;
|
||||
ListBox1: TListBox;
|
||||
OpenPictureDialog1: TOpenPictureDialog;
|
||||
@ -83,6 +85,9 @@ begin
|
||||
gdeDisabled: Result := Image2;
|
||||
gdeHighlighted: Result := Image3;
|
||||
gdeShadowed: Result := Image4;
|
||||
gde1Bit: Result := Image5;
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -101,7 +106,8 @@ begin
|
||||
begin
|
||||
Bmp := TBitmap.Create;
|
||||
ImageList1.GetBitmap(AIndex, Bmp, AEffect);
|
||||
ImageMap[AEffect].Picture.Assign(Bmp);
|
||||
if ImageMap[AEffect] <> nil then
|
||||
ImageMap[AEffect].Picture.Assign(Bmp);
|
||||
Bmp.Free;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user