void automation_EditText(object sender, AnnEditTextEventArgs e) { RemoveAutomationTextBox(true); if (e.TextObject == null) { return; } _automationTextBox = new AutomationTextBox(_viewer, this._automation, e, RemoveAutomationTextBox); }
public AutomationTextBox(Control parent, AnnAutomation automation, AnnEditTextEventArgs editTextEvent, RemoveAction removeAction) { if (parent == null) { throw new ArgumentNullException("parent"); } if (editTextEvent == null) { throw new ArgumentNullException("editTextEvent"); } _textObject = editTextEvent.TextObject; if (_textObject == null) { throw new InvalidOperationException("No annotation text object was found in the event"); } _removeAction = removeAction; _automation = automation; var rect = editTextEvent.Bounds.ToLeadRect(); rect.Inflate(12, 12); this.SuspendLayout(); this.Location = new Point(rect.X, rect.Y); this.Size = new Size(rect.Width, rect.Height); this.AutoSize = false; this.Tag = _textObject; this.Text = _textObject.Text; this.Name = "AnnotationsText"; this.Font = AnnWinFormsRenderingEngine.ToFont(_textObject.Font); var brush = _textObject.TextForeground as AnnSolidColorBrush; if (brush != null) { this.ForeColor = Color.FromName(brush.Color); } this.WordWrap = false; this.AcceptsReturn = true; this.Multiline = true; this.ResumeLayout(); //this.LostFocus += new EventHandler(AutomationTextBox_LostFocus); //this.KeyPress += new KeyPressEventHandler(AutomationTextBox_KeyPress); parent.Controls.Add(this); this.Focus(); this.SelectAll(); }
private void automation_EditText(object sender, AnnEditTextEventArgs e) { var automation = _documentViewer.Annotations.Automation; if (automation == null) { return; } RemoveAutomationTextBox(true); if (e.TextObject == null) { return; } var imageViewer = _documentViewer.View.ImageViewer; _automationTextBox = new AutomationTextBox(imageViewer, automation, e, RemoveAutomationTextBox); // we haven't changed yet e.Cancel = true; }
void automation_EditText(object sender, AnnEditTextEventArgs e) { TextBox text = new TextBox(); Rectangle rc = new Rectangle((int)e.Bounds.Left, (int)e.Bounds.Top, (int)e.Bounds.Width, (int)e.Bounds.Height); rc.Inflate(12, 12); text.Location = rc.Location; text.Size = rc.Size; text.AutoSize = false; text.Tag = e.TextObject; text.Text = e.TextObject.Text; text.ForeColor = Color.FromName((e.TextObject.TextForeground as AnnSolidColorBrush).Color); text.Font = AnnWinFormsRenderingEngine.ToFont(e.TextObject.Font); text.WordWrap = false; text.AcceptsReturn = true; text.Multiline = true; text.Tag = e.TextObject; text.LostFocus += new EventHandler(text_LostFocus); _imageViewer.Controls.Add(text); text.Focus(); text.SelectAll(); }