Beispiel #1
0
        internal override void StartDrag(MouseEventArgs e)
        {
            _startLoc      = new Point(e.X, e.Y);
            _previousLoc   = new Point(e.X, e.Y);
            screenGraphics = Chart.CreateGraphics();
            backBuffer     = new MemGraphics(Chart.Width, Chart.Height);
            frontBuffer    = new MemGraphics(Chart.Width, Chart.Height);
            Chart.Draw(backBuffer.Graphics);
            var rect = CurrentPane.ClientToChart(CurrentPane.CanvasRect);

            frontBuffer.Graphics.SetClip(rect);
            pen   = new Pen(ForeColor);
            brush = new SolidBrush(BackColor);
            DrawSelection(_startLoc, _startLoc);
        }
Beispiel #2
0
        internal override void FinishDrag(MouseEventArgs e)
        {
            if (PaneFrameTool.PaneMoveStyle == PaneMoveStyle.Blend)
            {
                _imageAttr.Dispose();
                _imageAttr   = null;
                _colorMatrix = null;
            }
            else
            {
                _pen.Dispose();
            }
            _screenGraphics.Dispose();
            _backBuffer.Dispose();
            _frontBuffer.Dispose();
            Point point = CurrentPane.ClientToChart(new Point(e.X, e.Y));
            Pane  topPane;

            if (point.Y < Chart.ClientRect.Top)
            {
                topPane = Chart.Panes.TopPane;
            }
            else if (point.Y > ((Chart.ClientRect.Bottom - 1) - Chart.Panes.XAxisPane.FixedHeight))
            {
                topPane = Chart.Panes.BottomPane;
            }
            else
            {
                topPane = Owner.FindPane(Chart.ClientRect.Left, point.Y);
            }
            if ((topPane != CurrentPane) && (topPane != null))
            {
                int index = Chart.Panes.PositionList.IndexOf(CurrentPane);
                if (Chart.Panes.PositionList.IndexOf(topPane) > index)
                {
                    Chart.Panes.PositionList.Remove(CurrentPane);
                    int num3 = Chart.Panes.PositionList.IndexOf(topPane);
                    Chart.Panes.PositionList.Insert(num3 + 1, CurrentPane);
                }
                else
                {
                    Chart.Panes.PositionList.Remove(CurrentPane);
                    int num4 = Chart.Panes.PositionList.IndexOf(topPane);
                    Chart.Panes.PositionList.Insert(num4, CurrentPane);
                }
            }
            Chart.PerformLayout();
        }
Beispiel #3
0
        private void DrawSelection(Point previousLoc, Point currentLoc)
        {
            Point point = CurrentPane.ClientToChart(_startLoc);

            previousLoc = CurrentPane.ClientToChart(previousLoc);
            currentLoc  = CurrentPane.ClientToChart(currentLoc);
            Rectangle rectangle  = CurrentPane.ClientToChart(CurrentPane.CanvasRect);
            Rectangle rectangle2 = previousLoc.X > point.X
                                       ? new Rectangle(point.X, rectangle.Y, (previousLoc.X - point.X) + 1, rectangle.Height)
                                       : new Rectangle(previousLoc.X, rectangle.Y, (point.X - previousLoc.X) + 1, rectangle.Height);
            Rectangle rectangle3 = currentLoc.X > point.X
                                       ? new Rectangle(point.X, rectangle.Y, (currentLoc.X - point.X) + 1, rectangle.Height)
                                       : new Rectangle(currentLoc.X, rectangle.Y, (point.X - currentLoc.X) + 1, rectangle.Height);

            backBuffer.Render(frontBuffer, rectangle2);
            frontBuffer.Graphics.FillRectangle(brush, rectangle3);
            frontBuffer.Graphics.DrawLine(pen, rectangle3.Left, rectangle3.Top, rectangle3.Left, rectangle3.Bottom);
            if (rectangle3.Width > 0)
            {
                frontBuffer.Graphics.DrawLine(pen, rectangle3.Right - 1, rectangle3.Top, rectangle3.Right - 1,
                                              rectangle3.Bottom);
            }
            frontBuffer.Render(screenGraphics, Rectangle.Union(rectangle2, rectangle3));
        }