private void rightClick(object sender, MouseEventArgs e) { if (!locked && e.Button == MouseButtons.Right) { using (FormEditor_ChangeType form = new FormEditor_ChangeType()) { form.StartPosition = FormStartPosition.Manual; form.Location = new System.Drawing.Point(Cursor.Position.X, Cursor.Position.Y); form.ShowDialog(); if (form.DialogResult == DialogResult.Yes) { switch (form.result) { case "Textbox": CustomTextboxLabel textBox = new CustomTextboxLabel(); textBox.textBox.Multiline = false; textBox.pdfAttribute = this.pdfAttribute; textBox.label.Text = rememberName; textBox.Draggable(true); Parent.Controls.Add(textBox); textBox.Location = this.Location; textBox.Width = textBox.label.Width + textBox.textBox.Width; Parent.Controls.Remove(this); break; case "BigTextbox": CustomTextboxLabel multitextBox = new CustomTextboxLabel(); multitextBox.textBox.Multiline = true; multitextBox.pdfAttribute = this.pdfAttribute; multitextBox.label.Text = rememberName; multitextBox.Height = 78; multitextBox.Draggable(true); Parent.Controls.Add(multitextBox); multitextBox.Location = this.Location; multitextBox.Width = multitextBox.label.Width + multitextBox.textBox.Width; Parent.Controls.Remove(this); break; case "Combobox": break; case "Checkbox": EditableCheckbox checkbox = new EditableCheckbox(); checkbox.Text = rememberName; checkbox.pdfAttribute = this.pdfAttribute; checkbox.Parent = this.Parent; checkbox.Draggable(true); Parent.Controls.Add(checkbox); checkbox.Location = this.Location; Parent.Controls.Remove(this); break; default: break; } } } } }
private void Transform(object sender, MouseEventArgs e) { if (!locked && e.Button == MouseButtons.Right) { using (FormEditor_ChangeType form = new FormEditor_ChangeType()) { form.StartPosition = FormStartPosition.Manual; form.Location = new System.Drawing.Point(Cursor.Position.X, Cursor.Position.Y); form.ShowDialog(); if (form.DialogResult == DialogResult.Yes) { switch (form.result) { case "Textbox": if (textBox.Multiline) { textBox.Multiline = false; textBox.Size = new System.Drawing.Size(textBox.Width, 22); this.Width = label.Width + textBox.Width; this.Height = textBox.Height; } break; case "BigTextbox": if (!textBox.Multiline) { textBox.Multiline = true; this.Height = 78; textBox.Size = new System.Drawing.Size(textBox.Width, 78); this.Width = label.Width + textBox.Width; } break; case "Combobox": EditableCombobox combobox = new EditableCombobox(); combobox.Text = label.Text; combobox.Parent = this.Parent; combobox.Draggable(true); combobox.rememberName = label.Text; combobox.pdfAttribute = this.pdfAttribute; combobox.combobox.Items.Add(label.Text); combobox.combobox.SelectedIndex = 0; Parent.Controls.Add(combobox); combobox.Location = this.Location; Parent.Controls.Remove(this); break; case "Checkbox": EditableCheckbox checkbox = new EditableCheckbox(); checkbox.Text = label.Text; checkbox.Parent = this.Parent; checkbox.pdfAttribute = this.pdfAttribute; checkbox.Draggable(true); Parent.Controls.Add(checkbox); checkbox.Location = this.Location; Parent.Controls.Remove(this); break; default: break; } } } } }