From Clomosy Docs

No edit summary
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
SetImage(TComponent, xImageFile)
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
procedure SetImage(xComponent:TCLComponent,'xImageFile');
</div>


Provides the ability to add images to the component.<br>
<span style="color:blue"><i>xComponent</i></span> : The variable name of the defined component is written.<br>


<span style="color:blue">''TComponent''</span> : The variable name of the defined component is written.
<span style="color:blue"><i>xImageFile</i></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.<br>


<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.
It is a procedure used to display an image in visual components.<br>


<b>Example</b><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>
<pre>
var
  MyForm:TclForm;
  testImg : TclImage;
{
  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(''Background design..'');');
  MyForm.Run;
}
</pre>
<b>Output:</b><br>
[[File:Image.png|frameless|450px]]<br>


'''Code:'''<br>
<h2> See Also </h2>
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>
* [[TclForm | TclForm]]
'''var'''
* [[TclImage | TclImage]]
MyForm:TclForm;
{{#seo:|title=SetImage in Clomosy - Clomosy Docs}}
testImg : TclImage;<br>
{{#seo:|description=Explore SetImage in Clomosy! Simplify image handling in your app, optimizing the display of visual content for better engagement.}}
'''begin'''
MyForm := TclForm.Create(Self);
testImg:= MyForm.AddNewImage(MyForm,'testImg');
testImg.Align := alClient;
testImg.Height := 250;
testImg.Width := 300;<br>
MyForm.setImage(testImg,'https://clomosy.com/demos/bg.png');
MyForm.AddNewEvent(testImg,tbeOnClick,'ShowMessage(<nowiki>''Nature is everything.''</nowiki>);');
MyForm.Run;<br>
'''end;'''
'''Output:'''<br>
[[File:Image.png|frameless|450px]]

Latest revision as of 13:14, 24 December 2024

xComponent : 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.

It is a procedure used to display an image in visual components.

Example
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;
 
 {
   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(''Background design..'');');
   MyForm.Run;
 
 }

Output:
Image.png

See Also