Пример #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;
     }
 }
Пример #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;
            }
        }
Пример #3
0
 public Button(Control parent)
     : base(parent)
 {
 }
Пример #4
0
 public MouseControlEventArgs(Control sourceControl)
     : base(sourceControl)
 {
 }
Пример #5
0
 public KeyControlEventArgs(Control sourceControl)
     : base(sourceControl)
 {
 }
Пример #6
0
 public ControlEventArgs(Control sourceControl)
 {
     this.SourceControl = sourceControl;
 }
Пример #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);
 }
Пример #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);
 }
Пример #9
0
 public Textbox(Control parent)
     : base(parent)
 {
     this.BackColor = Color.White;
     this.CaretPosition = -1;
 }