Beispiel #1
0
 internal void StartResize(SelectionDot selectionDot, MouseButtonEventArgs e)
 {
     _resizingCorner = selectionDot.Corner;
     _chartX.Status  = StockChartX.ChartStatus.LineStudyMoving;
     C.CaptureMouse();
 }
Beispiel #2
0
        internal void Paint(double x, double y, LineStatus lineStatus, Types.Corner corner)
        {
            if (!_drawn && lineStatus == LineStatus.RePaint)
            {
                _drawn = true;
                Update();
                DrawLineStudy(new Types.RectEx(), LineStatus.StartPaint);
            }
            switch (lineStatus)
            {
            case LineStatus.StartPaint:
                _dStartX = x;
                _dStartY = y;
                DrawLineStudy(new Types.RectEx(), lineStatus);
                break;

            case LineStatus.Painting:
                SetRect(x, y);
                DrawLineStudy(_newRect, lineStatus);
                break;

            case LineStatus.EndPaint:
                SetXY(x, y, lineStatus);
                _dStartX = _dStartY = 0.0;
                Reset();

                _newRect = new Types.RectEx(_x1, _y1, _x2, _y2);
                DrawLineStudy(_newRect, lineStatus);
                break;

            case LineStatus.RePaint:
                DrawLineStudy(_newRect = new Types.RectEx(_x1, _y1, _x2, _y2), lineStatus);
                break;

            case LineStatus.StartMove:
                _dStartX = x;
                _dStartY = y;
                break;

            case LineStatus.Moving:
                switch (corner)
                {
                case Types.Corner.BottomRight:
                    _x2 = x;
                    _y2 = y;
                    break;

                case Types.Corner.MiddleRight:
                    _x2 = x;
                    break;

                case Types.Corner.TopRight:
                    _x2 = x;
                    _y1 = y;
                    break;

                case Types.Corner.TopCenter:
                    _y1 = y;
                    break;

                case Types.Corner.TopLeft:
                    _x1 = x;
                    _y1 = y;
                    break;

                case Types.Corner.MiddleLeft:
                    _x1 = x;
                    break;

                case Types.Corner.BottomLeft:
                    _x1 = x;
                    _y2 = y;
                    break;

                case Types.Corner.BottomCenter:
                    _y2 = y;
                    break;

                case Types.Corner.MoveAll:
                    _x1     -= (_dStartX - x);
                    _y1     -= (_dStartY - y);
                    _x2     -= (_dStartX - x);
                    _y2     -= (_dStartY - y);
                    _dStartX = x;
                    _dStartY = y;
                    break;
                }
                _newRect = new Types.RectEx(_x1, _y1, _x2, _y2);
                DrawLineStudy(_newRect, lineStatus);
                ShowSelection(true);
                _oldRect = _newRect;
                break;

            case LineStatus.EndMove:
                SetXY(x, y, lineStatus);
                Reset();

                _newRect = new Types.RectEx(_x1, _y1, _x2, _y2);
                DrawLineStudy(_newRect, lineStatus);
                _resizingCorner = Types.Corner.None;
                break;
            }

            if (lineStatus == LineStatus.RePaint)
            {
                ShowSelection(_selected);
            }

            _drawn = true;
        }