From Clomosy Docs
(Created page with " SetImage(TComponent, xImageFile) Provides the ability to add images to the component.<br> <span style="color:blue">''TComponent''</span> : The variable name of the defined component is written. <span style="color:blue">''xImageFile''</span> : 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:'''<br> Now let's see the code part. Let's define the image variable. After that, let's create a fi...") |
No edit summary |
||
| Line 11: | Line 11: | ||
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).<br> | 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).<br> | ||
'''var''' | '''var''' | ||
MyForm: | MyForm:TclForm; | ||
testImg : TclImage;<br> | testImg : TclImage;<br> | ||
'''begin''' | '''begin''' | ||
MyForm := | MyForm := TclForm.Create(Self); | ||
testImg:= MyForm.AddNewImage(MyForm,'testImg'); | testImg:= MyForm.AddNewImage(MyForm,'testImg'); | ||
testImg.Align := alCenter; | testImg.Align := alCenter; | ||
Revision as of 10:42, 12 April 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 := alCenter; testImg.Height := 250; testImg.Width := 300;
MyForm.setImage(testImg,'https://thedispatch.blob.core.windows.net/thedispatchimages/2022/04/1913623-990x494.jpeg'); MyForm.AddNewEvent(testImg,tbeOnClick,'ShowMessage(''Nature is everything.'');'); MyForm.Run;
end;