From Clomosy Docs
m (ClomosyManager moved page TclProLabelImage to TclProImage) |
No edit summary |
||
| Line 33: | Line 33: | ||
</blockquote> | </blockquote> | ||
'''Code:'''<br> | '''Code:'''<br> | ||
:'''Base Syntax''' | |||
'''Var''' | '''Var''' | ||
MyForm:TclForm; | MyForm:TclForm; | ||
| Line 40: | Line 42: | ||
testImg := MyForm.AddNewProImage(MyForm,'testImg'); | testImg := MyForm.AddNewProImage(MyForm,'testImg'); | ||
clComponent.SetupComponent(testImg,'{"Align" : "Center","MarginBottom":135,"Width" :150, "Height":150,"RoundHeight":10,"RoundWidth":10,"BorderColor":"#fabd2","BorderWidth":2, | clComponent.SetupComponent(testImg,'{"Align" : "Center","MarginBottom":135,"Width" :150, "Height":150,"RoundHeight":10,"RoundWidth":10,"BorderColor":"#fabd2","BorderWidth":2, | ||
"ImgUrl":"https:// | "ImgUrl":"https://clomosy.com/demos/computerNetwork.png", "ImgFit":"yes"}'); | ||
'''end;'''<br> | '''end;'''<br> | ||
'''begin''' | '''begin''' | ||
| Line 47: | Line 49: | ||
MyForm.Run; | MyForm.Run; | ||
'''end;''' | '''end;''' | ||
:'''TRObject Syntax''' | |||
Var | |||
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> | '''Output:'''<br> | ||
[[File:ProImage.png|frameless|450px]] | [[File:ProImage.png|frameless|450px]] | ||
Revision as of 11:41, 12 February 2024
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:
- Base Syntax
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://clomosy.com/demos/computerNetwork.png", "ImgFit":"yes"}'); end;
begin MyForm := TclForm.Create(Self); SetImage; MyForm.Run; end;
- TRObject Syntax
Var
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;
}