From Clomosy Docs
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. Parameters used in json structure:
- 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.
Var
testImg: TClProImage;
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.
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://img.icons8.com/external-wanicon-lineal-color-wanicon/512/external-information-communication-wanicon-lineal-color-wanicon.png", "ImgFit":"yes"}');
Code:
Var MyForm:TclForm; testImg: TClProImage;
procedure SetImage; begin 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://img.icons8.com/external-wanicon-lineal-color-wanicon/512/external-information-communication-wanicon-lineal-color-wanicon.png", "ImgFit":"yes"}'); end;
begin MyForm := TclForm.Create(Self); SetImage; MyForm.Run; end;