Beispiel #1
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 #2
0
		/// <summary>
		/// Default Constructor
		/// </summary>
		public GraphControl()
		{
			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 += ZedGraphControl_MouseDown;
			base.MouseUp += ZedGraphControl_MouseUp;
			base.MouseMove += 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("UIGraphLib.GraphLocale",
				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, "Title", "X Axis", "Y Axis" );
			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>
        /// Initializes a new instance of the <see cref="GraphPane"/> class. 
        /// Constructor for deserializing objects
        /// </summary>
        /// <param name="info">
        /// A <see cref="SerializationInfo"/> instance that defines the serialized data
        /// </param>
        /// <param name="context">
        /// A <see cref="StreamingContext"/> instance that contains the serialized data
        /// </param>
        protected GraphPane(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            // The schema value is just a file version parameter.  You can use it to make future versions
            // backwards compatible as new member variables are added to classes
            int sch = info.GetInt32("schema2");

            this._xAxis = (XAxis)info.GetValue("xAxis", typeof(XAxis));
            if (sch >= 11)
            {
                this._x2Axis = (X2Axis)info.GetValue("x2Axis", typeof(X2Axis));
            }
            else
            {
                this._x2Axis = new X2Axis(string.Empty);
            }

            this._yAxisList = (YAxisList)info.GetValue("yAxisList", typeof(YAxisList));
            this._y2AxisList = (Y2AxisList)info.GetValue("y2AxisList", typeof(Y2AxisList));

            this._curveList = (CurveList)info.GetValue("curveList", typeof(CurveList));

            this._chart = (Chart)info.GetValue("chart", typeof(Chart));

            this._barSettings = (BarSettings)info.GetValue("barSettings", typeof(BarSettings));
            this._barSettings._ownerPane = this;

            this._isIgnoreInitial = info.GetBoolean("isIgnoreInitial");
            this._isBoundedRanges = info.GetBoolean("isBoundedRanges");
            this._isIgnoreMissing = info.GetBoolean("isIgnoreMissing");
            this._isAlignGrids = info.GetBoolean("isAlignGrids");

            this._lineType = (LineType)info.GetValue("lineType", typeof(LineType));

            this._zoomStack = new ZoomStateStack();
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GraphPane"/> class. 
        /// The Copy Constructor
        /// </summary>
        /// <param name="rhs">
        /// The GraphPane object from which to copy
        /// </param>
        public GraphPane(GraphPane rhs)
            : base(rhs)
        {
            // copy values for all the value types
            this._isIgnoreInitial = rhs.IsIgnoreInitial;
            this._isBoundedRanges = rhs._isBoundedRanges;
            this._isAlignGrids = rhs._isAlignGrids;

            this._chart = rhs._chart.Clone();

            this._barSettings = new BarSettings(rhs._barSettings, this);

            this._lineType = rhs.LineType;

            // copy all the reference types with deep copies
            this._xAxis = new XAxis(rhs.XAxis);
            this._x2Axis = new X2Axis(rhs.X2Axis);

            this._yAxisList = new YAxisList(rhs._yAxisList);
            this._y2AxisList = new Y2AxisList(rhs._y2AxisList);

            this._curveList = new CurveList(rhs.CurveList);
            this._zoomStack = new ZoomStateStack(rhs._zoomStack);
        }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GraphPane"/> class. 
        /// Constructor for the <see cref="GraphPane"/> object.  This routine will initialize all member variables and classes, setting appropriate default
        /// values as defined in the <see cref="Default"/> class.
        /// </summary>
        /// <param name="rect">
        /// A rectangular screen area where the graph is to be displayed. This area can be any size, and can be resize at any time using the
        /// <see cref="PaneBase.Rect"/> property.
        /// </param>
        /// <param name="title">
        /// The <see cref="PaneBase.Title"/> for this <see cref="GraphPane"/>
        /// </param>
        /// <param name="xTitle">
        /// The <see cref="Axis.Title"/> for the <see cref="XAxis"/>
        /// </param>
        /// <param name="yTitle">
        /// The <see cref="Axis.Title"/> for the <see cref="YAxis"/>
        /// </param>
        public GraphPane(RectangleF rect, string title, string xTitle, string yTitle)
            : base(title, rect)
        {
            this._xAxis = new XAxis(xTitle);
            this._x2Axis = new X2Axis(string.Empty);

            this._yAxisList = new YAxisList();
            this._y2AxisList = new Y2AxisList();

            this._yAxisList.Add(new YAxis(yTitle));
            this._y2AxisList.Add(new Y2Axis(string.Empty));

            this._curveList = new CurveList();
            this._zoomStack = new ZoomStateStack();

            this._isIgnoreInitial = Default.IsIgnoreInitial;
            this._isBoundedRanges = Default.IsBoundedRanges;
            this._isAlignGrids = false;

            this._chart = new Chart();

            this._barSettings = new BarSettings(this);

            this._lineType = Default.LineType;
        }
Beispiel #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZedGraphControl"/> class. Default Constructor
        /// </summary>
        public ZedGraphControl()
        {
            this.InitializeComponent();

            // These commands do nothing, but they get rid of the compiler warnings for
            // unused events
            bool b = this.MouseDown == null || this.MouseUp == null || this.MouseMove == null;

            // Link in these events from the base class, since we disable them from this class.
            base.MouseDown += this.ZedGraphControl_MouseDown;
            base.MouseUp += this.ZedGraphControl_MouseUp;
            base.MouseMove += this.ZedGraphControl_MouseMove;

            // this.MouseWheel += new System.Windows.Forms.MouseEventHandler( this.ZedGraphControl_MouseWheel );

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

            // isTransparentBackground = false;
            // SetStyle( ControlStyles.Opaque, false );
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            // this.BackColor = Color.Transparent;
            var asm = Assembly.GetExecutingAssembly();
            var resNames = asm.GetManifestResourceNames();
            foreach (var res in resNames)
            {
                if (res.Contains("ZedGraphLocale"))
                {
                    var r = res.Substring(0, res.Length - 10);
                    this._resourceManager = new ResourceManager(r, asm);
                    break;
                }
            }

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

            string titleStr = this._resourceManager.GetString("title_def");
            string xStr = this._resourceManager.GetString("x_title_def");
            string yStr = this._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();
            }

            this._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;

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

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

            this._zoomState = null;
            this._zoomStateStack = new ZoomStateStack();
        }
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();
        }