Button Class (RWE.GameOn.Core)

Class
Button

Usage:

Represents a standard label of text.

Button

Properties:

  • Text.ToString
    String – Sets the text value for the label.
Button1.Text.ToString = "Cancel";
  • Enabled
    Boolean – Defines whether the UI Element is interact-able or not.
Button1.Enabled = false;
  • AutoSize
    Boolean – Sets whether the UI Element should be autosized.
Button1.AutoSize = true;
  • Font
    Variable – Sets the font for the application
Button1.Font = default;
Button1.Font = new Font("Arial", 24,FontStyle.Bold);
  • Font.Size
    Variable – Sets the size of the font
Button1.Font.Size = default;
Button1.Font.Size = 12px;

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

//Note: you can change the font style using .Font, as follows:
Button1.Font = new Font("Arial", 12,FontStyle.Bold);
  • Font.Weight
    Variable – Sets the weight of the font.
Button1.Font.Weight = FontStyle.SemiBold;
Button1.Font.Weight = 300;

//Note: you can change the font style using .Font, as follows:
Button1.Font = new Font("CustomFont", 12,FontStyle.SemiBold);
Button1.Font = new Font("CustomFont", 12,Font.Weight(300));
  • BorderStyle
    Variable – Sets the border style of the button.
Button1.BorderStyle = Single;
  • BorderStyle.Colour
    Variable – Sets the border colour of the button.
Button1.BorderStyle.Colour = ColourSpace.Red;
Button1.BorderStyle.Colour = new ColourSpace(HEX("#hexcode"));
Button1.BorderStyle.Colour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));
Button1.BorderStyle.Colour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));

//You can use .Color and ColorSpace too!
  • BorderStyle.Weight
    Variable – Sets the border weight.
Button1.BorderStyle.Weight = 1px;
  • BackColour
    Variable – Sets the background colour.
Button1.BackColour = ColourSpace.Red;
Button1.BackColour = new ColourSpace(HEX("#hexcode"));
Button1.BackColour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));
Button1.BackColour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));

//You can use .BackColor and ColorSpace too!
  • Anchor
    Variable – Anchors the panel relative to a side or multiple sides of the application.
Button1.Anchor = top, left;
Button1.Anchor = bottom, top;
Button1.Anchor = left;
  • Activity
    Clause – Creates a new activity when the button is interacted with. By default, the interaction is OnClick.
//OnClick
Button1.Activity(new Activity) { //activities go here }

//OnClick (Defined)
Button1.Activity(new Activity, OnClick) { //activities go here }

//OnHover
Button1.Activity(new Activity, OnHover) { //activities go here }
      • Includes the following actions:
        • OnClick
        • OnHover
        • OnMouseEnter
        • OnMouseExit
        • OnRightClick
  • Visibility
    Variable – Determines whether the UI Element is visible or not.
Button1.Visibility = visible;
Button1.Visibility = invisible;

 

Example:

new ContentPanel = Panel1();
         Panel1.Dock = fill;
         Panel1.Padding.Left = 3px;
         Panel1.Contents 
         {
             new Button = Button1();
                 Button1.Text.ToString = "Click Me"
                 Button1.Font = default;
                 Button1.Font.Size = 12px;
         }
Menu