/* S E T V I E W D A T E T I M E S C R O L L */ /*---------------------------------------------------------------------------- * %%Function: SetViewDateTimeScroll * %%Qualified: bg.BgGraph.SetViewDateTimeScroll * %%Contact: rlittle * * ----------------------------------------------------------------------------*/ void SetViewDateTimeScroll(PictureBox pb, HScrollBar sbh, VScrollBar sbv, DateTime dttm, int iFirstQuarter) { if (BvFromPb(pb) == BoxView.Log) { Reporter rpt = (Reporter)pb.Tag; rpt.SetFirstDateTime(dttm); sbv.Value = rpt.GetFirstLine(); } else if (BvFromPb(pb) == BoxView.Graph) { Grapher grph = (Grapher)pb.Tag; if (iFirstQuarter >= 0) { grph.SetFirstFromScroll(iFirstQuarter); sbh.Value = iFirstQuarter; } else { grph.SetFirstDateTime(dttm.AddDays(-1.0)); if (grph.GetFirstForScroll() > sbh.Maximum) // if we have exceeded the scrolling regions, then we want to act as if we've scrolled to the end { grph.SetFirstFromScroll(sbh.Value); } if (grph.GetFirstForScroll() < 0) { grph.SetFirstFromScroll(0); } sbh.Value = grph.GetFirstForScroll(); } } pb.Invalidate(); }
/* S C R O L L P A I N T */ /*---------------------------------------------------------------------------- * %%Function: ScrollPaint * %%Qualified: bg.BgGraph.ScrollPaint * %%Contact: rlittle * * ----------------------------------------------------------------------------*/ private void ScrollPaint(object sender, System.EventArgs e) { if (m_fInPaint) { return; } m_fInPaint = true; HScrollBar sbh = (HScrollBar)sender; PictureBox pb = (PictureBox)sbh.Tag; if (BvFromPb(pb) == BoxView.Graph) { // its a report Grapher grph = (Grapher)pb.Tag; int iFirstQuarter = -1; grph.SetFirstFromScroll(iFirstQuarter = sbh.Value); DateTime dttm = grph.GetFirstDateTime(); SetViewDateTimeScroll(m_picbUpper, m_sbhUpper, m_sbvUpper, dttm, iFirstQuarter); SetViewDateTimeScroll(m_picbLower, m_sbhLower, m_sbvLower, dttm, iFirstQuarter); pb.Invalidate(); } m_fInPaint = false; }