From Clomosy Docs

Revision as of 15:05, 24 December 2024 by ClomosyAdmin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

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

The TclRectangle component represents a rectangle and is commonly used in interface designs as a background or region. Additionally, its appearance and properties can be customized using style properties.

Feature Use of Definition
TclRectangle Rectangle1 : TclRectangle; A variable belonging to the TclCircle class is created.
AddNewRectangle Rectangle1 = Form1.AddNewRectangle(Form1,'Rectangle1'); A new TclRectangle is added to the form.
Fill.Kind Rectangle1.Fill.Kind = fbkSolid; It is used to fill the inside of the object. This property determines how the interior fill of the object is applied. The following options can be used:
  • fbkNone: Does not fill the inside.
  • fbkSolid: Fills the inside with a single color.
  • fbkGradient: Fills the inside with a color gradient.
  • fbkBitmap: Fills the inside with a bitmap image.
  • fbkResource: Fills with a resource file (usually includes image files, text files, database connections, or similar things).
Fill.Bitmap.WrapMode Rectangle1.Fill.Bitmap.WrapMode = fbwmTileOriginal; It is used to specify a bitmap when filling the inside of the component and to control how this bitmap will be tiled. It determines how the bitmap will be placed and overlapped on a specific area. The following options can be used:
  • fbwmTile: The bitmap is tiled to completely fit the area to be filled.
  • fbwmTileOriginal: The bitmap is tiled according to its original size, and if it exceeds the boundaries of the area to be filled, it repeats the pattern.
  • fbwmTileStretch: The bitmap is stretched to fit the area to be filled and is placed fully within the area.
Stroke.Thickness Rectangle1.Stroke.Thickness = 3; It is used to set the thickness of the object's border. A value of 0 disables the border.
Sides Rectangle1.Sides = SetOf([sdLeft, sdTop, sdRight, sdBottom]); The Sides property is used to customize the width adjustments for each side of the object. By using SetOf, the dimensions of all four sides are defined. As shown above, the parameters are provided sequentially for the left, top, right, and bottom sides. For sides where no frame is desired, the corresponding parameter is removed.

Example

var
  anaForm:TclGameForm;
  Rectangle1: TclRectangle;
{
  anaForm = TclGameForm.Create(Self);
  
  Rectangle1 = anaForm.AddNewRectangle(anaForm, 'Rectangle1');
  Rectangle1.Fill.Kind = fbkBitmap; 
  Rectangle1.Fill.Bitmap.WrapMode = fbwmTile;
  Rectangle1.Width = 200; 
  Rectangle1.Height = 200;
  Rectangle1.Stroke.Thickness = 3;
  Rectangle1.Sides = SetOf([sdLeft, sdTop, sdBottom]);
  anaForm.Run;
}

See Also