/* P I C T U R E B O X S I Z E C H A N G E */ /*---------------------------------------------------------------------------- * %%Function: PictureBoxSizeChange * %%Qualified: bg.BgGraph.PictureBoxSizeChange * %%Contact: rlittle * * ----------------------------------------------------------------------------*/ void PictureBoxSizeChange(PictureBox pb, HScrollBar sbh, VScrollBar sbv) { Graphics gr = this.CreateGraphics(); RectangleF rcf = new RectangleF(Reporter.DxpFromDxa(gr, 100), Reporter.DypFromDya(gr, 100), pb.Width - Reporter.DxpFromDxa(gr, 200), pb.Height - Reporter.DypFromDya(gr, 200)); if (pb.Tag != null) { int iFirst = ((GraphicBox)pb.Tag).GetFirstForScroll(); GraphicBox gb = null; if (BvFromPb(pb) == BoxView.Graph) { pb.Tag = gb = (GraphicBox) new Grapher(rcf, gr); } else if (BvFromPb(pb) == BoxView.Log) { pb.Tag = gb = (GraphicBox) new Reporter(rcf, gr); } if (gb != null) { gb.SetProps(m_gp); gb.SetDataPoints(m_oData, sbv, sbh); gb.Calc(); gb.SetFirstFromScroll(iFirst); } pb.Invalidate(); } }
/* S E T G R A P H I C V I E W S */ /*---------------------------------------------------------------------------- * %%Function: SetGraphicViews * %%Qualified: bg.BgGraph.SetGraphicViews * %%Contact: rlittle * * ----------------------------------------------------------------------------*/ public void SetGraphicViews(BoxView bvUpper, BoxView bvLower) { if (bvUpper == BoxView.None && bvLower == BoxView.None) { throw(new Exception("Illegal BoxView parameters")); } m_bvUpper = bvUpper; m_bvLower = bvLower; SetupViews(this.ClientSize.Height); Graphics gr = this.CreateGraphics(); RectangleF rectfUpper = new RectangleF(Reporter.DxpFromDxa(gr, 100), Reporter.DypFromDya(gr, 100), m_picbUpper.Width - Reporter.DxpFromDxa(gr, 200), m_picbUpper.Height - Reporter.DypFromDya(gr, 200)); RectangleF rectfLower = new RectangleF(Reporter.DxpFromDxa(gr, 100), Reporter.DypFromDya(gr, 100), m_picbLower.Width - Reporter.DxpFromDxa(gr, 200), m_picbLower.Height - Reporter.DypFromDya(gr, 200)); switch (bvUpper) { case BoxView.Log: m_picbUpper.Tag = new Reporter(rectfUpper, gr); break; case BoxView.Graph: m_picbUpper.Tag = new Grapher(rectfUpper, gr); break; case BoxView.Meal: m_picbUpper.Tag = new MealCharter(rectfUpper, gr); break; } switch (bvLower) { case BoxView.Log: m_picbLower.Tag = new Reporter(rectfLower, gr); break; case BoxView.Graph: m_picbLower.Tag = new Grapher(rectfLower, gr); break; case BoxView.Meal: m_picbLower.Tag = new MealCharter(rectfLower, gr); break; } }