protected override void OnMouseDoubleClick(MouseEventArgs e) { PointF point = new PointF(e.X / _zoom, e.Y / _zoom); if (Cursor == Cursors.VSplit) { Graphics graphics = Graphics.FromHwnd(this.Handle); InitGraphics(graphics); _resizeColumnCommand = new ResizeColumnCommand(Program.Document, (Column)_glyph); _resizeColumnCommand.Resize(_glyph.GetFillWidth(graphics)); Program.Document.Add(_resizeColumnCommand); _resizeColumnCommand = null; _control.Refresh( ); } else { _glyph = Find(point); if (_glyph is Cell && (_glyph as Cell).IsEdit || (_glyph is Row && (_glyph as Row).IsEditName)) { _timer.Stop( ); Capture = false; ShowEdit(_glyph); } } base.OnMouseDoubleClick(e); }
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); }