From Clomosy Docs

Revision as of 12:23, 22 August 2024 by ClomosyManager (talk | contribs)

AddNewProImage(TComponent, xName): TClProImage

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.

The available SetupComponent properties for TclProButton are:

  • Width
  • Height
  • PositionX
  • PositionY
  • Align
  • TextColor
  • BackgroundColor
  • MarginTop
  • MarginBottom
  • MarginRight
  • MarginLeft
  • RoundHeight
  • RoundWidth
  • BorderColor
  • BorderWidth
  • ImgFit
  • ImgStretch
  • ImgUrl

To learn the purpose and usage of the SetupComponent and clProSettings properties, please refer to the page.

Let's define the proButton at the beginning.

Var
 ProImg1: TClProImage;

Let's add the object to the form. Then, we'll assign properties to our image using both the SetupComponent structure and clProSettings.

For clProSettings:
ProImg1 = Form1.AddNewProImage(Form1,'ProImg1');
ProImg1.Align = alCenter;
ProImg1.Width = 150;
ProImg1.Height = 150;
ProImg1.clProSettings.BorderColor = clAlphaColor.clHexToColor('#fabd2');
ProImg1.clProSettings.FontColor = clAlphaColor.clDarkorchid;
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);
For SetupComponent:
 ProImg1 = Form1.AddNewProImage(Form1,'ProImg1');
 clComponent.SetupComponent(ProImg1,'{"Align" : "Center", "Width":150, "Height":150, "RoundHeight":10, "RoundWidth":10, "BorderColor":"#fabd2", "BorderWidth":2, "ImgUrl":"https://clomosy.com/demos/computerNetwork.png", "ImgFit":"yes"}');

Example:

TRObject Syntax
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.FontColor = clAlphaColor.clDarkorchid;
  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;
}
Base Syntax
Var   
  Form1:TclForm;
  ProImg1: TClProImage;

procedure SetImage;
begin
  ProImg1 := Form1.AddNewProImage(Form1,'ProImg1');
  ProImg1.Align := alCenter;
  ProImg1.Width := 150;
  ProImg1.Height := 150;
  ProImg1.clProSettings.BorderColor := clAlphaColor.clHexToColor('#fabd2');
  ProImg1.clProSettings.FontColor := clAlphaColor.clDarkorchid;
  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);
end;

begin
  Form1 := TclForm.Create(Self);
  SetImage;
  Form1.Run;
end;

Output:
ProImage.png