protected override void OnMouseDown(MouseEventArgs e) { if (!Focused) { if (state == eState.Edit) { HideEdit(glyphEdit); _control.Refresh(); } Focus(); } if (state == eState.None && _glyph != null) { if (Cursor == Cursors.VSplit) { state = eState.ResizeColumn; _resizeColumnCommand = new ResizeColumnCommand(Program.Document, (Column)_glyph); Capture = true; } else if (Cursor == cursorMoveRow) { state = eState.MoveRow; _moveRowCommand = new MoveRowCommand(Program.Document, (Row)glyphSelect); Capture = true; } else { PointF point = new PointF(e.X / _zoom, e.Y / _zoom); _glyph = Find(point); if (_glyph != null && glyphSelect != _glyph) { _control.Select(this, _glyph); } else if (glyphSelect != null) { ContextMenuStrip = glyphSelect.GetContextMenu(this); if (glyphSelect is Cell) { _control.ChangeSelect((glyphSelect as Cell).Object); } else { _control.ChangeSelect(null); } } } } base.OnMouseDown(e); }
protected override void OnMouseUp(MouseEventArgs e) { if (state == eState.ResizeColumn || state == eState.MoveRow) { state = eState.None; Capture = false; Cursor = Cursors.Arrow; if (_moveRowCommand != null) { Program.Document.Add(_moveRowCommand); _moveRowCommand = null; } else if (_resizeColumnCommand != null) { Program.Document.Add(_resizeColumnCommand); _resizeColumnCommand = null; } } base.OnMouseUp(e); }