private void TextBoxExLostFocus(object sender, EventArgs e) { if (textBox.Visible) { string text = textBox.Text; Font font = textBox.Font; Color color = textBox.ForeColor; HideTextBox(); if (OperateManager.OperateCount > 0) { OperateObject obj = OperateManager.OperateList[OperateManager.OperateCount - 1]; if (obj.OperateType == OperateType.DrawText) { DrawTextData textData = obj.Data as DrawTextData; if (!textData.Completed) { if (string.IsNullOrEmpty(text)) { OperateManager.RedoOperate(); } else { obj.Color = color; textData.Font = font; textData.Text = text; textData.Completed = true; } } } } base.Invalidate(); } }
private void DrawToolsControlButtonRedoClick(object sender, EventArgs e) { if (OperateManager.OperateCount > 0) { OperateManager.RedoOperate(); base.Invalidate(); } else { if (SelectedImage) { ResetSelectImage(); base.Invalidate(); } } }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (textBox.Visible) { if (SelectImageRect.Contains(e.Location) || e.Button == MouseButtons.Left) { string text = textBox.Text; Font font = textBox.Font; Color color = textBox.ForeColor; HideTextBox(); if (OperateManager.OperateCount > 0) { OperateObject obj = OperateManager.OperateList[OperateManager.OperateCount - 1]; if (obj.OperateType == OperateType.DrawText) { DrawTextData textData = obj.Data as DrawTextData; if (!textData.Completed) { if (string.IsNullOrEmpty(text)) { OperateManager.RedoOperate(); } else { obj.Color = color; textData.Font = font; textData.Text = text; textData.Completed = true; } } } } } base.Invalidate(); return; } if (e.Button == MouseButtons.Left) { if (SelectedImage) { if (SizeGrip != SizeGrip.None) { _mouseDown = true; _mouseDownPoint = e.Location; HideDrawToolsControl(); base.Invalidate(); } if (DrawStyle != DrawStyle.None) { if (SelectImageRect.Contains(e.Location)) { _mouseDown = true; _mouseDownPoint = e.Location; if (DrawStyle == DrawStyle.Line) { LinePointList.Add(_mouseDownPoint); } ClipCursor(false); } } } else { _mouseDown = true; _mouseDownPoint = e.Location; } } if (e.Button == MouseButtons.Right) { this.DialogResult = System.Windows.Forms.DialogResult.Cancel; return; } }