/// <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; } }
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; } }
public Button(Control parent) : base(parent) { }
public MouseControlEventArgs(Control sourceControl) : base(sourceControl) { }
public KeyControlEventArgs(Control sourceControl) : base(sourceControl) { }
public ControlEventArgs(Control sourceControl) { this.SourceControl = sourceControl; }
/// <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); }
/// <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); }
public Textbox(Control parent) : base(parent) { this.BackColor = Color.White; this.CaretPosition = -1; }