/// <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> /// Default Constructor /// </summary> public ZedGraphControl() { InitializeComponent(); // These commands do nothing, but they get rid of the compiler warnings for // unused events bool b = MouseDown == null || MouseUp == null || MouseMove == null; // Link in these events from the base class, since we disable them from this class. base.MouseDown += new System.Windows.Forms.MouseEventHandler( this.ZedGraphControl_MouseDown ); base.MouseUp += new System.Windows.Forms.MouseEventHandler( this.ZedGraphControl_MouseUp ); base.MouseMove += new System.Windows.Forms.MouseEventHandler( this.ZedGraphControl_MouseMove ); //this.MouseWheel += new System.Windows.Forms.MouseEventHandler( this.ZedGraphControl_MouseWheel ); // Use double-buffering for flicker-free updating: SetStyle( ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw, true ); //isTransparentBackground = false; //SetStyle( ControlStyles.Opaque, false ); SetStyle( ControlStyles.SupportsTransparentBackColor, true ); //this.BackColor = Color.Transparent; _resourceManager = new ResourceManager( "VixenModules.App.Curves.ZedGraph.ZedGraphLocale", Assembly.GetExecutingAssembly()); Rectangle rect = new Rectangle( 0, 0, this.Size.Width, this.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, "Title", "X Axis", "Y Axis" ); GraphPane graphPane = new GraphPane( rect, titleStr, xStr, yStr ); using ( Graphics g = this.CreateGraphics() ) { graphPane.AxisChange( g ); //g.Dispose(); } _masterPane.Add( graphPane ); this.hScrollBar1.Minimum = 0; this.hScrollBar1.Maximum = 100; this.hScrollBar1.Value = 0; this.vScrollBar1.Minimum = 0; this.vScrollBar1.Maximum = 100; this.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(); }
/// <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; }
/// <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 (GraphPane != null) { _xScrollRange.Min = GraphPane.XAxis.Scale._rangeMin; _xScrollRange.Max = GraphPane.XAxis.Scale._rangeMax; _xScrollRange.IsScrollable = true; for (int i = 0; i < GraphPane.YAxisList.Count; i++) { Axis axis = GraphPane.YAxisList[i]; var range = new ScrollRange(axis.Scale._rangeMin, axis.Scale._rangeMax, _yScrollRangeList[i].IsScrollable); if (i >= _yScrollRangeList.Count) _yScrollRangeList.Add(range); else _yScrollRangeList[i] = range; } for (int i = 0; i < GraphPane.Y2AxisList.Count; i++) { Axis axis = GraphPane.Y2AxisList[i]; var range = new ScrollRange(axis.Scale._rangeMin, axis.Scale._rangeMax, _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> /// Add a <see cref="ScrollRange"/> object to the collection at the end of the list. /// </summary> /// <param name="item">The <see cref="ScrollRange"/> object to be added</param> /// <seealso cref="IList.Add"/> public int Add( ScrollRange item ) { return List.Add( item ); }
/// <summary> /// Insert a <see cref="ScrollRange"/> object into the collection at the specified /// zero-based index location. /// </summary> /// <param name="index">The zero-based index location for insertion.</param> /// <param name="item">The <see cref="ScrollRange"/> object that is to be /// inserted.</param> /// <seealso cref="IList.Insert"/> public void Insert( int index, ScrollRange item ) { List.Insert( index, item ); }