TextLabel Class (RWE.GameOn.Core.Extensions)

Class
TextLabel

Usage:

Represents a standard label of text.

TextLabel

Properties:

  • Text.ToString
    String – Sets the text value for the label.
TextLabel1.Text.ToString = "Hello World";
  • AutoSize
    Boolean – Defines whether the UI Element should be autosized.
TextLabel1.AutoSize = true;
  • Height
    Variable – Sets the height of the UI Element.
TextLabel1.Height = 30px;
  • Width
    Variable – Sets the width of the UI Element.
TextLabel1.Width = true;
  • Font
    Variable – Sets the font for the application
TextLabel1.Font = default;
TextLabel1.Font = new Font("Arial", 24,FontStyle.Bold);
  • Font.Size
    Variable – Sets the size of the font
TextLabel1.Font.Size = default;
TextLabel1.Font.Size = 12px;

//Note: you can change the font size using .Font, as follows:
TextLabel1.Font = new Font("Arial", 12,FontStyle.Bold);
  • Font.Style
    Variable – Sets the style of the font
TextLabel1.Font.Style = FontStyle.Bold;
TextLabel1.Font.Style = FontStyle.Underline;
TextLabel1.Font.Style = FontStyle.Italic;
TextLabel1.Font.Style = FontStyle.Strikethrough;

//Note: you can change the font style using .Font, as follows:
TextLabel1.Font = new Font("Arial", 12,FontStyle.Bold);
  • Font.Colour
    Variable – Sets the Colour of the Font
TextLabel1.Font.Colour = ColourSpace.Red;
TextLabel1.Font.Colour = new ColourSpace(HEX("#hexcode"));
TextLabel1.Font.Colour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));
TextLabel1.Font.Colour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));

//You can use .Color and ColorSpace too!
  • Font.Weight
    Variable – Sets the weight of the font.
TextLabel1.Font.Weight = FontStyle.SemiBold;
TextLabel1.Font.Weight = 300;

//Note: you can change the font style using .Font, as follows:
TextLabel1.Font = new Font("CustomFont", 12,FontStyle.SemiBold);
TextLabel1.Font = new Font("CustomFont", 12,Font.Weight(300));
  • visibility
    Variable – Determines whether the UI Element is visible or not.
TextLabel1.Visibility = visible;
TextLabel1.Visibility = invisible;
  • dock
    Variable – Docks the UI element to a specific location within the container or window.
TextLabel1.Dock = top;
TextLabel1.Dock = left;
TextLabel1.Dock = right;
TextLabel1.Dock = bottom;
TextLabel1.Dock = fill;
TextLabel1.Dock = none;
  • Padding
    Variable – Adds padding to the UI element.
TextLabel1.Padding.Top = 3px;
TextLabel1.Padding.Left = 3px;
TextLabel1.Padding.Right = 3px;
TextLabel1.Padding.Bottom = 3px;
TextLabel1.Padding.All = 3px;
  • anchor
    Variable – Defines a location for the UI element to anchor to within the container.
TextLabel1.Anchor = top, left;
TextLabel1.Dock = bottom, right;

Example:

new ContentPanel = Panel1();
         Panel1.Dock = fill;
         Panel1.Padding.Left = 3px;
         Panel1.Contents 
         {
             new TextLabel = HelloWorldText();
                 HelloWorldText.Text.ToString = "Hello World"
                 HelloWorldText.Font = default;
                 HelloWorldText.Font.Size = 12px;
         }
Menu