Example #1
0
 /// <summary>
 /// Create a control by type name.
 /// </summary>
 /// <param name="value">The name of the type of control to create (ex Button).</param>
 /// <param name="parent">The parent control.</param>
 /// <returns></returns>
 public virtual Control CreateControl(string value, Control parent)
 {
     switch (value)
     {
         case "Button":
                 return this.CreateButton(parent);
         case "Textbox":
                 return this.CreateTextbox(parent);
         default:
                 return null;
     }
 }
Example #2
0
        protected Control(Control parent)
        {
            this.Parent = parent;
            this.Area = new Rectangle(1, 1, 0, 0);
            this.Children = new Collection<Control>();
            this.BackColor = Color.LightGray;
            this.ForeColor = Color.Black;
            this.IsDirty = true;
            this.IsVisible = true;
            this.MinimumHeight = 10;
            this.MinimumWidth = 10;
            this.MaximumHeight = int.MaxValue;
            this.MaximumWidth = int.MaxValue;
            this.Text = string.Empty;

            if (parent != null)
            {
                parent.Children.Add(this);

                var guiManager = parent as GuiManager;
                if (guiManager != null)
                {
                    this.GuiManager = guiManager;
                }
                else
                {
                    this.GuiManager = parent.GuiManager;
                }
            }
            else
            {
                var manager = this as GuiManager;
                if (manager!=null)
                {
                    this.GuiManager = manager;
                }
            }

            if (this.GuiManager != null)
            {
                this.Font = this.GuiManager.DefaultFont;
            }
        }
Example #3
0
 public Button(Control parent)
     : base(parent)
 {
 }
Example #4
0
 public MouseControlEventArgs(Control sourceControl)
     : base(sourceControl)
 {
 }
Example #5
0
 public KeyControlEventArgs(Control sourceControl)
     : base(sourceControl)
 {
 }
Example #6
0
 public ControlEventArgs(Control sourceControl)
 {
     this.SourceControl = sourceControl;
 }
Example #7
0
 /// <summary>
 /// Create a new textbox.
 /// </summary>
 /// <param name="parent">The parent control.</param>
 /// <returns></returns>
 public virtual Textbox CreateTextbox(Control parent)
 {
     return new Textbox(parent);
 }
Example #8
0
 /// <summary>
 /// Create a new button.
 /// </summary>
 /// <param name="parent">The parent control.</param>
 /// <returns></returns>
 public virtual Button CreateButton(Control parent)
 {
     return new Button(parent);
 }
Example #9
0
 public Textbox(Control parent)
     : base(parent)
 {
     this.BackColor = Color.White;
     this.CaretPosition = -1;
 }