Using a FireMonkey
TspeedButton
on a form for a cross platform app, when setting the property StyleLookup
to use cameratoolbutton
is there any way of changing the size of this image, I can't seem to find anything.
There are at least two ways to do this, but all based on using stylebook.
First, simplest way - edit cameratoolbutton
style in stylebook:
cameratoolbutton
item in Structure
panelicon
subitem and change it's properties in Object Inspector
. For example, you can change Align
(Client
by default) and WrapMode
(Center
by default)Second way - do it in runtime. Add OnApplyStyleLookup
event handler to button and write code to work with style items:
procedure THeaderFooterForm.btn2ApplyStyleLookup(Sender: TObject);
var
obj: TFmxObject;
begin
obj:=TFmxObject(Sender).FindStyleResource('icon'); // use StyleName of inner object (see prev. picture)
if Assigned(obj) and (obj is TStyleObject) then // TStyleObject is class of "icon" (see prev. picture)
TStyleObject(obj).WrapMode:=TImageWrapMode.Stretch;
end;
Note 1: by default, you can't change size of cameratoolbutton
, because when you run program, it's size returns to hardcoded values. If you need this, you must do next workaround:
.style
fileobject TLayout StyleName = 'cameratoolbutton' Visible = False TabOrder = 160 FixedWidth = 44 FixedHeight = 44
FixedXXX
strings and save fileNote 2: style uses bitmaps, so if you need large/small picture, perhaps, you should use your own images