mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 12:20:25 +02:00
examples: improve stock images example
git-svn-id: trunk@19785 -
This commit is contained in:
parent
beb1e199bb
commit
11c966027b
@ -32,24 +32,41 @@ object Form1: TForm1
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 3
|
||||
Caption = 'Dialog Icons'
|
||||
Caption = 'Dialog Icons:'
|
||||
ClientHeight = 193
|
||||
ClientWidth = 188
|
||||
TabOrder = 0
|
||||
object DialogImage: TImage
|
||||
AnchorSideLeft.Control = GroupBox1
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
AnchorSideTop.Control = DialogCaptionLbl
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = GroupBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = DialogTrack
|
||||
Left = 6
|
||||
Height = 134
|
||||
Top = 6
|
||||
Height = 114
|
||||
Top = 26
|
||||
Width = 176
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
Center = True
|
||||
end
|
||||
object DialogCaptionLbl: TLabel
|
||||
AnchorSideLeft.Control = GroupBox1
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
AnchorSideRight.Control = GroupBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Top = 6
|
||||
Width = 176
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'DialogCaptionLbl'
|
||||
ParentColor = False
|
||||
end
|
||||
object DialogTrack: TTrackBar
|
||||
AnchorSideLeft.Control = GroupBox1
|
||||
AnchorSideRight.Control = GroupBox1
|
||||
@ -82,24 +99,41 @@ object Form1: TForm1
|
||||
BorderSpacing.Left = 3
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'Button Icons'
|
||||
Caption = 'Button Icons:'
|
||||
ClientHeight = 193
|
||||
ClientWidth = 187
|
||||
TabOrder = 1
|
||||
object ButtonImage: TImage
|
||||
AnchorSideLeft.Control = GroupBox2
|
||||
AnchorSideTop.Control = GroupBox2
|
||||
AnchorSideTop.Control = ButtonCaptionLbl
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = GroupBox2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ButtonTrack
|
||||
Left = 6
|
||||
Height = 134
|
||||
Top = 6
|
||||
Height = 114
|
||||
Top = 26
|
||||
Width = 175
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
Center = True
|
||||
end
|
||||
object ButtonCaptionLbl: TLabel
|
||||
AnchorSideLeft.Control = GroupBox2
|
||||
AnchorSideTop.Control = GroupBox2
|
||||
AnchorSideRight.Control = GroupBox2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Top = 6
|
||||
Width = 175
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'ButtonCaptionLbl'
|
||||
ParentColor = False
|
||||
end
|
||||
object ButtonTrack: TTrackBar
|
||||
AnchorSideLeft.Control = GroupBox2
|
||||
AnchorSideRight.Control = GroupBox2
|
||||
|
@ -1,3 +1,5 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TForm1','FORMDATA',[
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'c'#1#6'Height'#3#255#0#3'Top'#3#160#0#5'W'
|
||||
+'idth'#3#144#1#7'Caption'#6#18'Stock Icons Tester'#12'ClientHeight'#3#255#0
|
||||
@ -10,42 +12,55 @@ LazarusResources.Add('TForm1','FORMDATA',[
|
||||
+'t.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#7'BitBtn1'#4'Left'#2#6
|
||||
+#6'Height'#3#211#0#3'Top'#2#6#5'Width'#3#192#0#7'Anchors'#11#5'akTop'#6'akLe'
|
||||
+'ft'#7'akRight'#8'akBottom'#0#18'BorderSpacing.Left'#2#6#17'BorderSpacing.To'
|
||||
+'p'#2#6#19'BorderSpacing.Right'#2#3#7'Caption'#6#12'Dialog Icons'#12'ClientH'
|
||||
+'eight'#3#193#0#11'ClientWidth'#3#188#0#8'TabOrder'#2#0#0#6'TImage'#11'Dialo'
|
||||
+'gImage'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#21'AnchorSideTop.Control'
|
||||
+#7#9'GroupBox1'#23'AnchorSideRight.Control'#7#9'GroupBox1'#20'AnchorSideRigh'
|
||||
+'t.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#11'DialogTrack'#4'Lef'
|
||||
+'t'#2#6#6'Height'#3#134#0#3'Top'#2#6#5'Width'#3#176#0#7'Anchors'#11#5'akTop'
|
||||
+#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#6'Center'#9
|
||||
+#0#0#9'TTrackBar'#11'DialogTrack'#22'AnchorSideLeft.Control'#7#9'GroupBox1'
|
||||
+#23'AnchorSideRight.Control'#7#9'GroupBox1'#20'AnchorSideRight.Side'#7#9'asr'
|
||||
+'Bottom'#24'AnchorSideBottom.Control'#7#9'GroupBox1'#21'AnchorSideBottom.Sid'
|
||||
+'e'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2')'#3'Top'#3#146#0#5'Width'#3#176#0
|
||||
+#8'OnChange'#7#17'DialogTrackChange'#8'Position'#2#0#7'Anchors'#11#6'akLeft'
|
||||
+#7'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#8'TabOrder'#2#0#0#0#0
|
||||
+#9'TGroupBox'#9'GroupBox2'#22'AnchorSideLeft.Control'#7#6'Label1'#21'AnchorS'
|
||||
+'ideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control'#7#5'Owner'#20'Anchor'
|
||||
+'SideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#9'GroupBox1'
|
||||
+#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#203#0#6'Height'#3#211#0#3
|
||||
+'Top'#2#6#5'Width'#3#191#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akB'
|
||||
+'ottom'#0#18'BorderSpacing.Left'#2#3#17'BorderSpacing.Top'#2#6#19'BorderSpac'
|
||||
+'ing.Right'#2#6#7'Caption'#6#12'Button Icons'#12'ClientHeight'#3#193#0#11'Cl'
|
||||
+'ientWidth'#3#187#0#8'TabOrder'#2#1#0#6'TImage'#11'ButtonImage'#22'AnchorSid'
|
||||
+'eLeft.Control'#7#9'GroupBox2'#21'AnchorSideTop.Control'#7#9'GroupBox2'#23'A'
|
||||
+'nchorSideRight.Control'#7#9'GroupBox2'#20'AnchorSideRight.Side'#7#9'asrBott'
|
||||
+'om'#24'AnchorSideBottom.Control'#7#11'ButtonTrack'#4'Left'#2#6#6'Height'#3
|
||||
+#134#0#3'Top'#2#6#5'Width'#3#175#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRigh'
|
||||
+'t'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#6'Center'#9#0#0#9'TTrackBar'
|
||||
+#11'ButtonTrack'#22'AnchorSideLeft.Control'#7#9'GroupBox2'#23'AnchorSideRigh'
|
||||
+'t.Control'#7#9'GroupBox2'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'Anchor'
|
||||
+'SideBottom.Control'#7#9'GroupBox2'#21'AnchorSideBottom.Side'#7#9'asrBottom'
|
||||
+#4'Left'#2#6#6'Height'#2')'#3'Top'#3#146#0#5'Width'#3#175#0#8'OnChange'#7#17
|
||||
+'ButtonTrackChange'#8'Position'#2#0#7'Anchors'#11#6'akLeft'#7'akRight'#8'akB'
|
||||
+'ottom'#0#20'BorderSpacing.Around'#2#6#8'TabOrder'#2#0#0#0#0#7'TBitBtn'#7'Bi'
|
||||
+'tBtn1'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9
|
||||
+'asrBottom'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'
|
||||
+#7#9'asrBottom'#4'Left'#3'?'#1#6'Height'#2#26#3'Top'#3#223#0#5'Width'#2'K'#7
|
||||
+'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'
|
||||
+#2#6#7'Caption'#6#6'&Close'#20'Constraints.MinWidth'#2'K'#4'Kind'#7#7'bkClos'
|
||||
+'e'#8'TabOrder'#2#2#0#0#0
|
||||
+'p'#2#6#19'BorderSpacing.Right'#2#3#7'Caption'#6#13'Dialog Icons:'#12'Client'
|
||||
+'Height'#3#193#0#11'ClientWidth'#3#188#0#8'TabOrder'#2#0#0#6'TImage'#11'Dial'
|
||||
+'ogImage'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#21'AnchorSideTop.Control'
|
||||
+#7#16'DialogCaptionLbl'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideR'
|
||||
+'ight.Control'#7#9'GroupBox1'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'Anc'
|
||||
+'horSideBottom.Control'#7#11'DialogTrack'#4'Left'#2#6#6'Height'#2'r'#3'Top'#2
|
||||
+#26#5'Width'#3#176#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'
|
||||
+#0#20'BorderSpacing.Around'#2#6#6'Center'#9#0#0#6'TLabel'#16'DialogCaptionLb'
|
||||
+'l'#22'AnchorSideLeft.Control'#7#9'GroupBox1'#21'AnchorSideTop.Control'#7#9
|
||||
+'GroupBox1'#23'AnchorSideRight.Control'#7#9'GroupBox1'#20'AnchorSideRight.Si'
|
||||
+'de'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#14#3'Top'#2#6#5'Width'#3#176#0#7
|
||||
+'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#18'BorderSpacing.Left'#2#6#17'B'
|
||||
+'orderSpacing.Top'#2#6#19'BorderSpacing.Right'#2#6#7'Caption'#6#16'DialogCap'
|
||||
+'tionLbl'#11'ParentColor'#8#0#0#9'TTrackBar'#11'DialogTrack'#22'AnchorSideLe'
|
||||
+'ft.Control'#7#9'GroupBox1'#23'AnchorSideRight.Control'#7#9'GroupBox1'#20'An'
|
||||
+'chorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#9'GroupBo'
|
||||
+'x1'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2')'#3'T'
|
||||
+'op'#3#146#0#5'Width'#3#176#0#8'OnChange'#7#17'DialogTrackChange'#8'Position'
|
||||
+#2#0#7'Anchors'#11#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpacing.Aroun'
|
||||
+'d'#2#6#8'TabOrder'#2#0#0#0#0#9'TGroupBox'#9'GroupBox2'#22'AnchorSideLeft.Co'
|
||||
+'ntrol'#7#6'Label1'#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideRight.'
|
||||
+'Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBo'
|
||||
+'ttom.Control'#7#9'GroupBox1'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Lef'
|
||||
+'t'#3#203#0#6'Height'#3#211#0#3'Top'#2#6#5'Width'#3#191#0#7'Anchors'#11#5'ak'
|
||||
+'Top'#6'akLeft'#7'akRight'#8'akBottom'#0#18'BorderSpacing.Left'#2#3#17'Borde'
|
||||
+'rSpacing.Top'#2#6#19'BorderSpacing.Right'#2#6#7'Caption'#6#13'Button Icons:'
|
||||
+#12'ClientHeight'#3#193#0#11'ClientWidth'#3#187#0#8'TabOrder'#2#1#0#6'TImage'
|
||||
+#11'ButtonImage'#22'AnchorSideLeft.Control'#7#9'GroupBox2'#21'AnchorSideTop.'
|
||||
+'Control'#7#16'ButtonCaptionLbl'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'An'
|
||||
+'chorSideRight.Control'#7#9'GroupBox2'#20'AnchorSideRight.Side'#7#9'asrBotto'
|
||||
+'m'#24'AnchorSideBottom.Control'#7#11'ButtonTrack'#4'Left'#2#6#6'Height'#2'r'
|
||||
+#3'Top'#2#26#5'Width'#3#175#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8
|
||||
+'akBottom'#0#20'BorderSpacing.Around'#2#6#6'Center'#9#0#0#6'TLabel'#16'Butto'
|
||||
+'nCaptionLbl'#22'AnchorSideLeft.Control'#7#9'GroupBox2'#21'AnchorSideTop.Con'
|
||||
+'trol'#7#9'GroupBox2'#23'AnchorSideRight.Control'#7#9'GroupBox2'#20'AnchorSi'
|
||||
+'deRight.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#14#3'Top'#2#6#5'Width'
|
||||
+#3#175#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#18'BorderSpacing.Left'
|
||||
+#2#6#17'BorderSpacing.Top'#2#6#19'BorderSpacing.Right'#2#6#7'Caption'#6#16'B'
|
||||
+'uttonCaptionLbl'#11'ParentColor'#8#0#0#9'TTrackBar'#11'ButtonTrack'#22'Anch'
|
||||
+'orSideLeft.Control'#7#9'GroupBox2'#23'AnchorSideRight.Control'#7#9'GroupBox'
|
||||
+'2'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#9
|
||||
+'GroupBox2'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2
|
||||
+')'#3'Top'#3#146#0#5'Width'#3#175#0#8'OnChange'#7#17'ButtonTrackChange'#8'Po'
|
||||
+'sition'#2#0#7'Anchors'#11#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpaci'
|
||||
+'ng.Around'#2#6#8'TabOrder'#2#0#0#0#0#7'TBitBtn'#7'BitBtn1'#23'AnchorSideRig'
|
||||
+'ht.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSid'
|
||||
+'eBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'
|
||||
+#3'?'#1#6'Height'#2#26#3'Top'#3#223#0#5'Width'#2'K'#7'Anchors'#11#7'akRight'
|
||||
+#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6#6'&Cl'
|
||||
+'ose'#20'Constraints.MinWidth'#2'K'#4'Kind'#7#7'bkClose'#8'TabOrder'#2#2#0#0
|
||||
+#0
|
||||
]);
|
||||
|
@ -21,6 +21,8 @@ type
|
||||
GroupBox1: TGroupBox;
|
||||
GroupBox2: TGroupBox;
|
||||
Label1: TLabel;
|
||||
DialogCaptionLbl: TLabel;
|
||||
ButtonCaptionLbl: TLabel;
|
||||
procedure ButtonTrackChange(Sender: TObject);
|
||||
procedure DialogTrackChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
@ -63,22 +65,32 @@ end;
|
||||
|
||||
procedure TForm1.UpdateDialogImage;
|
||||
var
|
||||
Image, Mask: HBitmap;
|
||||
B: TCustomBitmap;
|
||||
begin
|
||||
if ThemeServices.GetStockImage(DialogTrack.Position + idDialogBase, Image, Mask) then
|
||||
DialogImage.Picture.Bitmap.LoadFromBitmapHandles(Image, Mask)
|
||||
B := GetDialogIcon(DialogTrack.Position + idDialogBase);
|
||||
if B <> nil then
|
||||
begin
|
||||
DialogImage.Picture.Graphic := B;
|
||||
B.Free;
|
||||
end
|
||||
else
|
||||
DialogImage.Picture.Clear;
|
||||
DialogCaptionLbl.Caption := GetDialogCaption(DialogTrack.Position + idDialogBase);
|
||||
end;
|
||||
|
||||
procedure TForm1.UpdateButtonImage;
|
||||
var
|
||||
Image, Mask: HBitmap;
|
||||
B: TCustomBitmap;
|
||||
begin
|
||||
if ThemeServices.GetStockImage(ButtonTrack.Position + idButtonBase, Image, Mask) then
|
||||
ButtonImage.Picture.Bitmap.LoadFromBitmapHandles(Image, Mask)
|
||||
B := GetButtonIcon(ButtonTrack.Position + idButtonBase);
|
||||
if B <> nil then
|
||||
begin
|
||||
ButtonImage.Picture.Graphic := B;
|
||||
B.Free;
|
||||
end
|
||||
else
|
||||
ButtonImage.Picture.Clear;
|
||||
ButtonCaptionLbl.Caption := GetButtonCaption(ButtonTrack.Position + idButtonBase);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
Loading…
Reference in New Issue
Block a user