public void DrawTextBox(ObjInfo ToDraw) { TextBox newTextBox = new TextBox(); newTextBox.Location = new System.Drawing.Point(ToDraw.PointX, ToDraw.PointY); newTextBox.Name = ToDraw.Name; newTextBox.Multiline = true; newTextBox.Size = new System.Drawing.Size(ToDraw.Width, ToDraw.Height); newTextBox.TabIndex = ToDraw.ControlIndex; newTextBox.Text = ToDraw.Text; newTextBox.Click += new System.EventHandler(this.Events_Button); newTextBox.MouseDown += (sender, e) => StartMovingOrResizing(newTextBox, e); newTextBox.MouseMove += (sender, e) => MoveControl(newTextBox, e); newTextBox.MouseUp += (sender, e) => StopDragOrResizing(newTextBox); CustomControls.Add(new ObjType(newTextBox)); Controls.Add(newTextBox); }
public void DrawButton(ObjInfo ToDraw) { Button newButton = new Button(); newButton.Location = new System.Drawing.Point(ToDraw.PointX, ToDraw.PointY); newButton.Name = ToDraw.Name; newButton.Size = new System.Drawing.Size(ToDraw.Width, ToDraw.Height); newButton.TabIndex = ToDraw.ControlIndex; newButton.Text = ToDraw.Text; newButton.UseVisualStyleBackColor = true; newButton.Click += new System.EventHandler(this.Events_Button); newButton.MouseDown += (sender, e) => StartMovingOrResizing(newButton, e); newButton.MouseMove += (sender, e) => MoveControl(newButton, e); newButton.MouseUp += (sender, e) => StopDragOrResizing(newButton); if (ToDraw.HasEvent) { newButton.Click += new System.EventHandler(this.AddEventMessage); } CustomControls.Add(new ObjType(newButton)); Controls.Add(newButton); }