Esempio n. 1
0
        protected void BitMatrix_MouseDown(object sender, MouseEventArgs e)
        {
            switch (_mode)
            {
            case BitMatrixMouseMode.Moving:
                if (IsResizable && _isInBottomRightCorner)
                {
                    _mode = BitMatrixMouseMode.Resizing;
                }
                else if (isOverGrid && ChangeBitState(e.Button, _lastPos))
                {
                    IsResizable = false;
                    this.Invalidate(new Rectangle(_workingRect.Left - 1, _workingRect.Top - 1, _workingRect.Width + 2, _workingRect.Height + 2));
                    this.Update();
                }
                break;

            case BitMatrixMouseMode.Resizing:
                break;
            }

            SetCursorView();

            if (MouseDownFired != null)
            {
                MouseDownFired(this, new BitMatrixEventArgs()
                {
                    Position = e.Location, ControlPosition = _lastPos, isInside = isOverGrid, Mode = _mode
                });
            }
        }
Esempio n. 2
0
        protected void BitMatrix_MouseUp(object sender, MouseEventArgs e)
        {
            _mode       = BitMatrixMouseMode.Moving;
            IsResizable = _preserveConfigIsResizable;

            var hasChanges = _workingRect.Contains(e.Location) != isOverGrid;

            if (hasChanges)
            {
                isOverGrid = !isOverGrid;
            }
            isOverGrid = _workingRect.Contains(e.Location);

            SetCursorView();

            if (hasChanges)
            {
                this.Invalidate(new Rectangle(_workingRect.Left - 1, _workingRect.Top - 1, _workingRect.Width + 2, _workingRect.Height + 2));
                this.Update();
            }
        }