Beispiel #1
0
 public void OnScroll(AbsListView aView, int aFirstVisibleItem, int aVisibleItemCount, int aTotalItemCount)
 {
     lock (iLock)
     {
         iVisibleScrollRange = new ScrollRange(aFirstVisibleItem, aFirstVisibleItem + aVisibleItemCount);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public ZeeGraphControl()
        {
            _dragPane = null;
            InitializeComponent();

            // Use double-buffering for flicker-free updating:
            SetStyle(ControlStyles.UserPaint |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.DoubleBuffer |
                     ControlStyles.ResizeRedraw, true);


            SetStyle(ControlStyles.SupportsTransparentBackColor, true);


            _resourceManager = new ResourceManager("ZeeGraph.ZeeGraphLocale",
                                                   Assembly.GetExecutingAssembly());

            Rectangle rect = new Rectangle(0, 0, Size.Width, Size.Height);

            _masterPane                 = new MasterPane("", rect);
            _masterPane.Margin.All      = 0;
            _masterPane.Title.IsVisible = false;

            string titleStr = _resourceManager.GetString("title_def");
            string xStr     = _resourceManager.GetString("x_title_def");
            string yStr     = _resourceManager.GetString("y_title_def");

            GraphPane graphPane = new GraphPane(rect, titleStr, xStr, yStr);

            using (Graphics g = CreateGraphics())
            {
                graphPane.AxisChange(g);
                //g.Dispose();
            }
            _masterPane.Add(graphPane);

            hScrollBar1.Minimum = 0;
            hScrollBar1.Maximum = 100;
            hScrollBar1.Value   = 0;

            vScrollBar1.Minimum = 0;
            vScrollBar1.Maximum = 100;
            vScrollBar1.Value   = 0;

            _xScrollRange      = new ScrollRange(true);
            _yScrollRangeList  = new ScrollRangeList();
            _y2ScrollRangeList = new ScrollRangeList();

            _yScrollRangeList.Add(new ScrollRange(true));
            _y2ScrollRangeList.Add(new ScrollRange(false));

            _zoomState      = null;
            _zoomStateStack = new ZoomStateStack();
        }
Beispiel #3
0
        /// <summary>
        /// Sets the value of the scroll range properties (see <see cref="ScrollMinX" />,
        /// <see cref="ScrollMaxX" />, <see cref="YScrollRangeList" />, and
        /// <see cref="Y2ScrollRangeList" /> based on the actual range of the data for
        /// each corresponding <see cref="Axis" />.
        /// </summary>
        /// <remarks>
        /// This method is called automatically by <see cref="AxisChange" /> if
        /// <see cref="IsAutoScrollRange" />
        /// is true.  Note that this will not be called if you call AxisChange directly from the
        /// <see cref="GraphPane" />.  For example, zedGraphControl1.AxisChange() works properly, but
        /// zedGraphControl1.GraphPane.AxisChange() does not.</remarks>
        public void SetScrollRangeFromData()
        {
            if (this.GraphPane != null)
            {
                double grace = CalcScrollGrace(this.GraphPane.XAxis.Scale._rangeMin,
                                               this.GraphPane.XAxis.Scale._rangeMax);

                _xScrollRange.Min          = this.GraphPane.XAxis.Scale._rangeMin - grace;
                _xScrollRange.Max          = this.GraphPane.XAxis.Scale._rangeMax + grace;
                _xScrollRange.IsScrollable = true;

                for (int i = 0; i < this.GraphPane.YAxisList.Count; i++)
                {
                    Axis axis = this.GraphPane.YAxisList[i];
                    grace = CalcScrollGrace(axis.Scale._rangeMin, axis.Scale._rangeMax);
                    ScrollRange range = new ScrollRange(axis.Scale._rangeMin - grace,
                                                        axis.Scale._rangeMax + grace, _yScrollRangeList[i].IsScrollable);

                    if (i >= _yScrollRangeList.Count)
                    {
                        _yScrollRangeList.Add(range);
                    }
                    else
                    {
                        _yScrollRangeList[i] = range;
                    }
                }

                for (int i = 0; i < this.GraphPane.Y2AxisList.Count; i++)
                {
                    Axis axis = this.GraphPane.Y2AxisList[i];
                    grace = CalcScrollGrace(axis.Scale._rangeMin, axis.Scale._rangeMax);
                    ScrollRange range = new ScrollRange(axis.Scale._rangeMin - grace,
                                                        axis.Scale._rangeMax + grace, _y2ScrollRangeList[i].IsScrollable);

                    if (i >= _y2ScrollRangeList.Count)
                    {
                        _y2ScrollRangeList.Add(range);
                    }
                    else
                    {
                        _y2ScrollRangeList[i] = range;
                    }
                }

                //this.GraphPane.CurveList.GetRange( out scrollMinX, out scrollMaxX,
                //		out scrollMinY, out scrollMaxY, out scrollMinY2, out scrollMaxY2, false, false,
                //		this.GraphPane );
            }
        }
        /// <summary>
        /// Sets the value of the scroll range properties (see <see cref="ScrollMinX" />,
        /// <see cref="ScrollMaxX" />, <see cref="YScrollRangeList" />, and 
        /// <see cref="Y2ScrollRangeList" /> based on the actual range of the data for
        /// each corresponding <see cref="Axis" />.
        /// </summary>
        /// <remarks>
        /// This method is called automatically by <see cref="AxisChange" /> if
        /// <see cref="IsAutoScrollRange" />
        /// is true.  Note that this will not be called if you call AxisChange directly from the
        /// <see cref="GraphPane" />.  For example, zedGraphControl1.AxisChange() works properly, but
        /// zedGraphControl1.GraphPane.AxisChange() does not.</remarks>
        public void SetScrollRangeFromData()
        {
            if ( this.GraphPane != null )
            {
                double grace = CalcScrollGrace( this.GraphPane.XAxis.Scale._rangeMin,
                            this.GraphPane.XAxis.Scale._rangeMax );

                _xScrollRange.Min = this.GraphPane.XAxis.Scale._rangeMin - grace;
                _xScrollRange.Max = this.GraphPane.XAxis.Scale._rangeMax + grace;
                _xScrollRange.IsScrollable = true;

                for ( int i = 0; i < this.GraphPane.YAxisList.Count; i++ )
                {
                    Axis axis = this.GraphPane.YAxisList[i];
                    grace = CalcScrollGrace( axis.Scale._rangeMin, axis.Scale._rangeMax );
                    ScrollRange range = new ScrollRange( axis.Scale._rangeMin - grace,
                        axis.Scale._rangeMax + grace, _yScrollRangeList[i].IsScrollable );

                    if ( i >= _yScrollRangeList.Count )
                        _yScrollRangeList.Add( range );
                    else
                        _yScrollRangeList[i] = range;
                }

                for ( int i = 0; i < this.GraphPane.Y2AxisList.Count; i++ )
                {
                    Axis axis = this.GraphPane.Y2AxisList[i];
                    grace = CalcScrollGrace( axis.Scale._rangeMin, axis.Scale._rangeMax );
                    ScrollRange range = new ScrollRange( axis.Scale._rangeMin - grace,
                            axis.Scale._rangeMax + grace, _y2ScrollRangeList[i].IsScrollable );

                    if ( i >= _y2ScrollRangeList.Count )
                        _y2ScrollRangeList.Add( range );
                    else
                        _y2ScrollRangeList[i] = range;
                }

                //this.GraphPane.CurveList.GetRange( out scrollMinX, out scrollMaxX,
                //		out scrollMinY, out scrollMaxY, out scrollMinY2, out scrollMaxY2, false, false,
                //		this.GraphPane );
            }
        }
Beispiel #5
0
        private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
        {
            if (this.GraphPane != null)
            {
                if ((e.Type != ScrollEventType.ThumbPosition &&
                     e.Type != ScrollEventType.ThumbTrack) ||
                    (e.Type == ScrollEventType.ThumbTrack &&
                     _zoomState == null))
                {
                    ZoomStateSave(this.GraphPane, ZoomState.StateType.Scroll);
                }
                for (int i = 0; i < this.GraphPane.YAxisList.Count; i++)
                {
                    ScrollRange scroll = _yScrollRangeList[i];
                    if (scroll.IsScrollable)
                    {
                        Axis axis = this.GraphPane.YAxisList[i];
                        HandleScroll(axis, e.NewValue, scroll.Min, scroll.Max, vScrollBar1.LargeChange,
                                     !axis.Scale.IsReverse);
                    }
                }

                for (int i = 0; i < this.GraphPane.Y2AxisList.Count; i++)
                {
                    ScrollRange scroll = _y2ScrollRangeList[i];
                    if (scroll.IsScrollable)
                    {
                        Axis axis = this.GraphPane.Y2AxisList[i];
                        HandleScroll(axis, e.NewValue, scroll.Min, scroll.Max, vScrollBar1.LargeChange,
                                     !axis.Scale.IsReverse);
                    }
                }

                ApplyToAllPanes(this.GraphPane);

                ProcessEventStuff(vScrollBar1, e);
            }
        }
Beispiel #6
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="ScrollRange"/> object from which to copy</param>
 public ScrollRange(ScrollRange rhs)
 {
     _min          = rhs._min;
     _max          = rhs._max;
     _isScrollable = rhs._isScrollable;
 }
Beispiel #7
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public ZeeGraphControl()
        {
            _dragPane = null;
            InitializeComponent();

            // Use double-buffering for flicker-free updating:
            SetStyle(ControlStyles.UserPaint |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.DoubleBuffer |
                     ControlStyles.ResizeRedraw, true);

            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            _resourceManager = new ResourceManager("ZeeGraph.ZeeGraphLocale",
                                                   Assembly.GetExecutingAssembly());

            Rectangle rect = new Rectangle(0, 0, Size.Width, Size.Height);
            _masterPane = new MasterPane("", rect);
            _masterPane.Margin.All = 0;
            _masterPane.Title.IsVisible = false;

            string titleStr = _resourceManager.GetString("title_def");
            string xStr = _resourceManager.GetString("x_title_def");
            string yStr = _resourceManager.GetString("y_title_def");

            GraphPane graphPane = new GraphPane(rect, titleStr, xStr, yStr);
            using (Graphics g = CreateGraphics())
            {
                graphPane.AxisChange(g);
                //g.Dispose();
            }
            _masterPane.Add(graphPane);

            hScrollBar1.Minimum = 0;
            hScrollBar1.Maximum = 100;
            hScrollBar1.Value = 0;

            vScrollBar1.Minimum = 0;
            vScrollBar1.Maximum = 100;
            vScrollBar1.Value = 0;

            _xScrollRange = new ScrollRange(true);
            _yScrollRangeList = new ScrollRangeList();
            _y2ScrollRangeList = new ScrollRangeList();

            _yScrollRangeList.Add(new ScrollRange(true));
            _y2ScrollRangeList.Add(new ScrollRange(false));

            _zoomState = null;
            _zoomStateStack = new ZoomStateStack();
        }
Beispiel #8
0
		/// <summary>
		/// The Copy Constructor
		/// </summary>
		/// <param name="rhs">The <see c_ref="ScrollRange"/> object from which to copy</param>
		public ScrollRange( ScrollRange rhs )
		{
			_min = rhs._min;
			_max = rhs._max;
			_isScrollable = rhs._isScrollable;
		}
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScrollRange"/> struct. 
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">
 /// The <see cref="ScrollRange"/> object from which to copy
 /// </param>
 public ScrollRange(ScrollRange rhs)
 {
     this._min = rhs._min;
     this._max = rhs._max;
     this._isScrollable = rhs._isScrollable;
 }