From Clomosy Docs

No edit summary
No edit summary
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
AddNewProImage(TComponent, xName): TClProImage
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
function AddNewProImage(AComponent: TCLComponent; xName: string): TClProImage;
</div>


It is used to add images into the project. All of the TclImage features are available. Apart from this, border color, rounding borders, image stretching and fitting features are available. Parameters used in json structure:<br>
<span style="color:blue"><b>AComponent</b></span> : Specifies the parent of the object to be defined.<br>
* Width
* Height
* PositionX
* PositionY
* Align
* TextColor
* BackgroundColor
* MarginTop
* MarginBottom
* MarginRight
* MarginLeft
* RoundHeight
* RoundWidth
* BorderColor
* BorderWidth
* ImgFit
* ImgStretch
* ImgUrl


Let's start with the definition to use ProImage.<br>
<span style="color:blue"><b>xName</b></span> : The name of the defined image should be written.<br>
<blockquote style="background-color:#F7F5EB">
'''Var'''<br>
testImg: TClProImage;
</blockquote>
We define proImg in MyForm. Let's add border color, resizing features for the picture apart from the standard definitions. Next, let's do border rounding.<br>
<blockquote style="background-color:#F7F5EB">
testImg := MyForm.'''AddNewProImage'''(MyForm,'testImg');<br>
  clComponent.SetupComponent(testImg,'{"Align" : "Center","MarginBottom":135,"Width" :150, "Height":150,"RoundHeight":10,"RoundWidth":10,"BorderColor":"#fabd2","BorderWidth":2,<br>
  "ImgUrl":"https://img.icons8.com/external-wanicon-lineal-color-wanicon/512/external-information-communication-wanicon-lineal-color-wanicon.png", "ImgFit":"yes"}');
</blockquote>
'''Code:'''<br>


:'''Base Syntax'''
 
  '''Var''' 
TclProImage is used to add an image to a form. Adding visuals to an application makes it more attractive and user-friendly.<br>
MyForm:TclForm;
All of the TclImage features are available. Apart from this, border color, rounding borders, image stretching and fitting features are available. <br>
testImg: TClProImage;<br>
 
'''procedure''' SetImage;
<div class="alert alert-info" role="alert" data-bs-theme="light">
  '''begin'''
Refer to the [[TclImage]] page for standard image usage.
  testImg := MyForm.AddNewProImage(MyForm,'testImg');
</div>
  clComponent.SetupComponent(testImg,'{"Align" : "Center","MarginBottom":135,"Width" :150, "Height":150,"RoundHeight":10,"RoundWidth":10,"BorderColor":"#fabd2","BorderWidth":2,
 
   "ImgUrl":"https://clomosy.com/demos/computerNetwork.png", "ImgFit":"yes"}');
<div class="table-responsive">
'''end;'''<br>
{| class="wikitable" style="border: 2px solid #c3d7e0"
'''begin'''
! style="background-color: #c3d7e0"| Feature !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"| Definition
   MyForm := TclForm.Create(Self);
|-
|TclProImage || ProImage1 : TclProImage; || A variable belonging to the TclProImage class is created.
|-
|AddNewProImage || ProImage1 = Form1.AddNewProImage(Form1,'ProImage1'); || A new image is added to the form.
|}
</div>
 
In addition to the features of a standard image, TclProImage offers new and advanced features, which we will explain in detail below.<br>
 
<div class="row">
<div class="col-lg-6">
<div  class="card d-flex flex-column justify-content-start gap-1 mb-3 h-100" style="padding: 3;">
<div style="font-size: 16px;font-weight: bold;text-align:left;">
  clProSettings Properties
</div>
<div style="font-size: 14px;font-weight: normal;text-align:justify; max-width: 350px;">
<li>BackgroundColor</li>
<li>BorderColor</li>
<li>IsTransparent</li>
<li>IsFill</li>
<li>RoundHeight</li>
<li>RoundWidth</li>
<li>IsRound</li>
<li>BorderWidth</li>
<li>PictureAutoFit</li>
<li>PictureStretch</li>
<li>PictureSource</li>
</div>
</div>
</div>
</div>
<br>
 
<div class="alert alert-warning" role="alert" data-bs-theme="light">
To learn the purpose and usage of the <b>clProSettings</b> properties, please refer to [[Pro Object Properties| the page]].
</div>
 
<b>Example</b><br>
 
<pre>
Var 
  Form1:TclForm;
  ProImg1: TClProImage;
 
void SetImage;
{
  ProImg1 = Form1.AddNewProImage(Form1,'ProImg1');
  ProImg1.Align = alCenter;
  ProImg1.Width = 150;
  ProImg1.Height = 150;
  ProImg1.clProSettings.BorderColor = clAlphaColor.clHexToColor('#fabd2');
  ProImg1.clProSettings.RoundHeight = 10;
  ProImg1.clProSettings.RoundWidth = 10;
  ProImg1.clProSettings.BorderWidth = 2;
  ProImg1.clProSettings.IsFill = True;
  ProImg1.clProSettings.IsRound = True;
   ProImg1.clProSettings.PictureSource = 'https://clomosy.com/demos/computerNetwork.png';
  ProImg1.clProSettings.PictureAutoFit = True;
  ProImg1.SetclProSettings(ProImg1.clProSettings);
}
 
{
   Form1 = TclForm.Create(Self);
   SetImage;
   SetImage;
   MyForm.Run;
   Form1.Run;
'''end;'''
}
</pre>


:'''TRObject Syntax'''
<b>Output:</b><br>
  Var 
[[File:ProImage.png|frameless|450px]]<br>
    MyForm:TclForm;
    testImg: TClProImage;
 
  void SetImage;
  {
    testImg = MyForm.AddNewProImage(MyForm,'testImg');
    clComponent.SetupComponent(testImg,'{"Align" : "Center","MarginBottom":135,"Width" :150, "Height":150,"RoundHeight":10,"RoundWidth":10,"BorderColor":"#fabd2","BorderWidth":2,
    "ImgUrl":"https://clomosy.com/demos/computerNetwork.png", "ImgFit":"yes"}');
  }
 
  {
    MyForm = TclForm.Create(Self);
    SetImage;
    MyForm.Run;
  }


'''Output:'''<br>
<h2> See Also </h2>
[[File:ProImage.png|frameless|450px]]
* [[Components]]
* [[Pro Object Properties]]
* [[Object Properties]]
{{#seo:|title=TclProImage Using in Clomosy - Clomosy Docs}}
{{#seo:|description=Discover TclProImage in Clomosy, a versatile image component with advanced features like border customization, rounded edges, and image fitting options.}}

Latest revision as of 08:46, 16 April 2025

AComponent : Specifies the parent of the object to be defined.

xName : The name of the defined image should be written.


TclProImage is used to add an image to a form. Adding visuals to an application makes it more attractive and user-friendly.
All of the TclImage features are available. Apart from this, border color, rounding borders, image stretching and fitting features are available.

Feature Use of Definition
TclProImage ProImage1 : TclProImage; A variable belonging to the TclProImage class is created.
AddNewProImage ProImage1 = Form1.AddNewProImage(Form1,'ProImage1'); A new image is added to the form.

In addition to the features of a standard image, TclProImage offers new and advanced features, which we will explain in detail below.

clProSettings Properties

  • BackgroundColor
  • BorderColor
  • IsTransparent
  • IsFill
  • RoundHeight
  • RoundWidth
  • IsRound
  • BorderWidth
  • PictureAutoFit
  • PictureStretch
  • PictureSource

  • Example

    Var   
      Form1:TclForm;
      ProImg1: TClProImage;
    
    void SetImage;
    {
      ProImg1 = Form1.AddNewProImage(Form1,'ProImg1');
      ProImg1.Align = alCenter;
      ProImg1.Width = 150;
      ProImg1.Height = 150;
      ProImg1.clProSettings.BorderColor = clAlphaColor.clHexToColor('#fabd2');
      ProImg1.clProSettings.RoundHeight = 10;
      ProImg1.clProSettings.RoundWidth = 10;
      ProImg1.clProSettings.BorderWidth = 2;
      ProImg1.clProSettings.IsFill = True; 
      ProImg1.clProSettings.IsRound = True;
      ProImg1.clProSettings.PictureSource = 'https://clomosy.com/demos/computerNetwork.png';
      ProImg1.clProSettings.PictureAutoFit = True;
      ProImg1.SetclProSettings(ProImg1.clProSettings);
    }
    
    {
      Form1 = TclForm.Create(Self);
      SetImage;
      Form1.Run;
    }
    

    Output:
    ProImage.png

    See Also