void OnCursorChangedHandler(ZedGraphWithCursorsControl sender, ZedGraphCursorEventArgs args)
        {
            ZedGraphCursor cursor = args.Cursor;

            if (this.cursor1.Position < Convert.ToDouble(this.minNumericUpDown.Minimum))
            {
                this.cursor1.Position = Convert.ToDouble(this.minNumericUpDown.Minimum);
                this.zedGraphControl.Invalidate();
            }

            if (this.cursor2.Position > Convert.ToDouble(this.maxNumericUpDown.Maximum))
            {
                this.cursor2.Position = Convert.ToDouble(this.maxNumericUpDown.Maximum);
                this.zedGraphControl.Invalidate();
            }

            MosaicWindow.MosaicInfo.ScaleMinIntensity = this.cursor1.Position;
            MosaicWindow.MosaicInfo.ScaleMaxIntensity = this.cursor2.Position;

            this.minNumericUpDown.Value = Convert.ToDecimal(MosaicWindow.MosaicInfo.ScaleMinIntensity);
            this.maxNumericUpDown.Value = Convert.ToDecimal(MosaicWindow.MosaicInfo.ScaleMaxIntensity);

            this.mosaicWindow.TileView.Clear(); // This possibly clears the intermidiate image
            this.mosaicWindow.TileView.Redraw();
        }
        void OnCursorChangedHandler(ZedGraphWithCursorsControl sender, ZedGraphCursorEventArgs args)
        {
            ZedGraphCursor cursor = args.Cursor;

            if (this.cursor1_1.Position < Convert.ToDouble(this.minNumericUpDown1.Minimum))
            {
                this.cursor1_1.Position = Convert.ToDouble(this.minNumericUpDown1.Minimum);
                this.zedGraphControl1.Invalidate();
            }

            if (this.cursor1_2.Position > Convert.ToDouble(this.maxNumericUpDown1.Maximum))
            {
                this.cursor1_2.Position = Convert.ToDouble(this.maxNumericUpDown1.Maximum);
                this.zedGraphControl1.Invalidate();
            }

            if (this.cursor2_1.Position < Convert.ToDouble(this.minNumericUpDown2.Minimum))
            {
                this.cursor2_1.Position = Convert.ToDouble(this.minNumericUpDown2.Minimum);
                this.zedGraphControl2.Invalidate();
            }

            if (this.cursor2_2.Position > Convert.ToDouble(this.maxNumericUpDown2.Maximum))
            {
                this.cursor2_2.Position = Convert.ToDouble(this.maxNumericUpDown2.Maximum);
                this.zedGraphControl2.Invalidate();
            }

            if (this.cursor3_1.Position < Convert.ToDouble(this.minNumericUpDown3.Minimum))
            {
                this.cursor3_1.Position = Convert.ToDouble(this.minNumericUpDown3.Minimum);
                this.zedGraphControl3.Invalidate();
            }

            if (this.cursor3_2.Position > Convert.ToDouble(this.maxNumericUpDown3.Maximum))
            {
                this.cursor3_2.Position = Convert.ToDouble(this.maxNumericUpDown3.Maximum);
                this.zedGraphControl3.Invalidate();
            }

            Tile.scaleMin[0] = this.cursor1_1.Position;
            Tile.scaleMax[0] = this.cursor1_2.Position;
            Tile.scaleMin[1] = this.cursor2_1.Position;
            Tile.scaleMax[1] = this.cursor2_2.Position;
            Tile.scaleMin[2] = this.cursor3_1.Position;
            Tile.scaleMax[2] = this.cursor3_2.Position;

            this.minNumericUpDown1.Value = Convert.ToDecimal(Tile.scaleMin[0]);
            this.maxNumericUpDown1.Value = Convert.ToDecimal(Tile.scaleMax[0]);
            this.minNumericUpDown2.Value = Convert.ToDecimal(Tile.scaleMin[1]);
            this.maxNumericUpDown2.Value = Convert.ToDecimal(Tile.scaleMax[1]);
            this.minNumericUpDown3.Value = Convert.ToDecimal(Tile.scaleMin[2]);
            this.maxNumericUpDown3.Value = Convert.ToDecimal(Tile.scaleMax[2]);

            this.mosaicWindow.TileView.Clear(); // This possibly clears the intermidiate image
            this.mosaicWindow.TileView.Redraw();
        }
        void OnCursorChangingHandler(ZedGraphWithCursorsControl sender, ZedGraphCursorEventArgs args)
        {
            // Don't allow the two cursors to overlap.
            ZedGraphCursor cursor = args.Cursor;

            if (cursor == this.cursor1_1)
            {
                if (this.cursor1_1.Position > this.cursor1_2.Position - this.cursor1_2.CursorSize)
                {
                    this.cursor1_1.Position = this.cursor1_2.Position - this.cursor1_2.CursorSize;
                }
                DisplayPlot(1);
            }
            else if (cursor == this.cursor1_2)
            {
                if (this.cursor1_2.Position < this.cursor1_1.Position + this.cursor1_1.CursorSize)
                {
                    this.cursor1_2.Position = this.cursor1_1.Position + this.cursor1_1.CursorSize;
                }
                DisplayPlot(1);
            }
            else if (cursor == this.cursor2_1)
            {
                if (this.cursor2_1.Position > this.cursor2_2.Position + this.cursor2_2.CursorSize)
                {
                    this.cursor2_1.Position = this.cursor2_2.Position + this.cursor2_2.CursorSize;
                }
                DisplayPlot(2);
            }
            else if (cursor == this.cursor2_2)
            {
                if (this.cursor2_2.Position < this.cursor2_1.Position + this.cursor2_1.CursorSize)
                {
                    this.cursor2_2.Position = this.cursor2_1.Position + this.cursor2_1.CursorSize;
                }
                DisplayPlot(2);
            }
            else if (cursor == this.cursor3_1)
            {
                if (this.cursor3_1.Position > this.cursor3_2.Position + this.cursor3_2.CursorSize)
                {
                    this.cursor3_1.Position = this.cursor3_2.Position + this.cursor3_2.CursorSize;
                }
                DisplayPlot(3);
            }
            else if (cursor == this.cursor3_2)
            {
                if (this.cursor3_2.Position < this.cursor3_1.Position + this.cursor3_1.CursorSize)
                {
                    this.cursor3_2.Position = this.cursor3_1.Position + this.cursor3_1.CursorSize;
                }
                DisplayPlot(3);
            }
        }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (this.cursors.Count == 0)
            {
                return;
            }

            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            PointF pt = new PointF();

            pt.X = (float)e.Location.X;
            pt.Y = (float)e.Location.Y;

            double x, y;

            this.GraphPane.ReverseTransform(pt, out x, out y);

            y = this.GraphPane.YAxis.Scale.Max - y;

            foreach (ZedGraphCursor cursor in this.cursors)
            {
                float      tolerance = 5.0F; // some tolerance in picking up the cursor
                RectangleF r         = new RectangleF((float)x - tolerance / 2, (float)y - tolerance / 2, tolerance, tolerance);

//                if (cursor.GraphRect.Contains((float)x, (float)y))
                if (cursor.GraphRect.IntersectsWith(r))
                {
                    oldPoint       = e.Location;
                    selectedCursor = cursor;
                    mouseDown      = true;
                    hit            = true;
                    return;
                }
            }

            return;
        }
        void OnCursorChangingHandler(ZedGraphWithCursorsControl sender, ZedGraphCursorEventArgs args)
        {
            // Don't allow the two cursors to overlap.
            ZedGraphCursor cursor = args.Cursor;

            if (cursor == this.cursor1)
            {
                if (this.cursor1.Position > this.cursor2.Position - this.cursor2.CursorSize)
                {
                    this.cursor1.Position = this.cursor2.Position - this.cursor2.CursorSize;
                }
            }
            else
            {
                if (this.cursor2.Position < this.cursor1.Position + this.cursor1.CursorSize)
                {
                    this.cursor2.Position = this.cursor1.Position + this.cursor1.CursorSize;
                }
            }
        }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (this.cursors.Count == 0)
                return;

            if (e.Button != MouseButtons.Left)
                return;

            PointF pt = new PointF();

            pt.X = (float)e.Location.X;
            pt.Y = (float)e.Location.Y;

            double x, y;

            this.GraphPane.ReverseTransform(pt, out x, out y);

            y = this.GraphPane.YAxis.Scale.Max - y;

            foreach (ZedGraphCursor cursor in this.cursors)
            {
                float tolerance = 5.0F;  // some tolerance in picking up the cursor
                RectangleF r = new RectangleF((float)x - tolerance / 2, (float)y - tolerance / 2, tolerance, tolerance);

            //                if (cursor.GraphRect.Contains((float)x, (float)y))
                if (cursor.GraphRect.IntersectsWith(r))
                {
                    oldPoint = e.Location;
                    selectedCursor = cursor;
                    mouseDown = true;
                    hit = true;
                    return;
                }
            }

            return;
        }
 public ZedGraphCursorEventArgs(ZedGraphCursor cursor, double position)
 {
     this.cursor = cursor;
     this.position = position;
 }
 public ZedGraphCursorEventArgs(ZedGraphCursor cursor, double position)
 {
     this.cursor   = cursor;
     this.position = position;
 }