From Clomosy Docs
No edit summary |
No edit summary |
||
| Line 16: | Line 16: | ||
MyForm := TclForm.Create(Self); | MyForm := TclForm.Create(Self); | ||
testImg:= MyForm.AddNewImage(MyForm,'testImg'); | testImg:= MyForm.AddNewImage(MyForm,'testImg'); | ||
testImg.Align := | testImg.Align := alClient; | ||
testImg.Height := 250; | testImg.Height := 250; | ||
testImg.Width := 300;<br> | testImg.Width := 300;<br> | ||
MyForm.setImage(testImg,'https:// | MyForm.setImage(testImg,'https://clomosy.com/demos/bg.png'); | ||
MyForm.AddNewEvent(testImg,tbeOnClick,'ShowMessage(<nowiki>''Nature is everything.''</nowiki>);'); | MyForm.AddNewEvent(testImg,tbeOnClick,'ShowMessage(<nowiki>''Nature is everything.''</nowiki>);'); | ||
MyForm.Run;<br> | MyForm.Run;<br> | ||
Revision as of 06:22, 9 October 2023
SetImage(TComponent, xImageFile)
Provides the ability to add images to the component.
TComponent : The variable name of the defined component is written.
xImageFile : You must add a string type url address to this field. You may encounter an error when the url address is not an image.
Code:
Now let's see the code part. Let's define the image variable. After that, let's create a field in the Form (AddNewImage) and add an image (SetImage).
var MyForm:TclForm; testImg : TclImage;
begin MyForm := TclForm.Create(Self); testImg:= MyForm.AddNewImage(MyForm,'testImg'); testImg.Align := alClient; testImg.Height := 250; testImg.Width := 300;
MyForm.setImage(testImg,'https://clomosy.com/demos/bg.png'); MyForm.AddNewEvent(testImg,tbeOnClick,'ShowMessage(''Nature is everything.'');'); MyForm.Run;
end;