private void EndEditLabel() { if (editLabelAction != null) { editLabelAction.EndEdit(); editLabelAction = null; } isEditLabel = false; }
public void StartEdit(BaseElement el, TextBox textBox) { if (!(el is ILabelElement)) { return; } if (((ILabelElement)el).Label.ReadOnly) { return; } this.siteLabelElement = el; this.labelElement = ((ILabelElement)siteLabelElement).Label; this.labelTextBox = textBox; if (siteLabelElement is BaseLinkElement) { this.direction = LabelEditDirection.Both; } else { this.direction = LabelEditDirection.UpDown; } EditLabelAction.SetTextBoxLocation(siteLabelElement, labelTextBox); labelTextBox.AutoSize = true; labelTextBox.Show(); labelTextBox.Text = labelElement.Text; labelTextBox.Font = labelElement.Font; labelTextBox.WordWrap = labelElement.Wrap; labelElement.Invalidate(); switch (labelElement.Alignment) { case StringAlignment.Near: labelTextBox.TextAlign = HorizontalAlignment.Left; break; case StringAlignment.Center: labelTextBox.TextAlign = HorizontalAlignment.Center; break; case StringAlignment.Far: labelTextBox.TextAlign = HorizontalAlignment.Right; break; } labelTextBox.KeyPress += new KeyPressEventHandler(labelTextBox_KeyPress); labelTextBox.Focus(); center.X = textBox.Location.X + (textBox.Size.Width / 2); center.Y = textBox.Location.Y + (textBox.Size.Height / 2); }
private void StartEditLabel() { isEditLabel = true; // Disable resize if (resizeAction != null) { resizeAction.ShowResizeCorner(false); resizeAction = null; } editLabelAction = new EditLabelAction(); editLabelAction.StartEdit(selectedElement, labelTextBox); }