/// <summary> /// Method called to Calculate the size required for /// the next Print. Calling this method initializes /// the values Size and Continued. Once these values /// are initialized, further calls to CalcSize have /// no affect, unless ResetSize() is called. /// </summary> /// <param name="reportDocument">The parent ReportDocument that is printing.</param> /// <param name="g">Graphics object to print on.</param> /// <param name="bounds">Bounds of the area to print within.</param> public void CalcSize( ReportDocument reportDocument, Graphics g, Bounds bounds) { BeginPrint(g); if (this.requiresNonEmptyBounds && bounds.IsEmpty()) { this.fits = false; } else if (!this.sized) { // two default values this.sizingBounds = LimitBounds(bounds); SectionSizeValues vals = DoCalcSize(reportDocument, g, this.sizingBounds); SetSize(vals.RequiredSize, bounds); if (this.keepTogether && vals.Continued) { this.fits = false; } else { this.fits = vals.Fits; } this.continued = vals.Continued; this.sized = true; } }
/// <summary> /// Method called to Calculate the size required for /// the next Print. Calling this method initializes /// the values Size and Continued. Once these values /// are initialized, further calls to CalcSize have /// no affect, unless ResetSize() is called. /// </summary> /// <param name="reportDocument">The parent ReportDocument that is printing.</param> /// <param name="g">Graphics object to print on.</param> /// <param name="bounds">Bounds of the area to print within.</param> public void CalcSize( ReportDocument reportDocument, Graphics g, Bounds bounds) { BeginPrint(g); if (this.requiresNonEmptyBounds && bounds.IsEmpty()) { this.fits = false; } else if (!this.sized) { // two default values this.sizingBounds = LimitBounds (bounds); SectionSizeValues vals = DoCalcSize(reportDocument, g, this.sizingBounds); SetSize (vals.RequiredSize, bounds); if (this.keepTogether && vals.Continued) { this.fits = false; } else { this.fits = vals.Fits; } this.continued = vals.Continued; this.sized = true; } }
/// <summary> /// Called to actually print this section. /// The DoCalcSize method will be called exactly once prior to each /// call of DoPrint. /// It should obey the value or Size and Continued as set by /// DoCalcSize(). /// </summary> /// <param name="reportDocument">The parent ReportDocument that is printing.</param> /// <param name="g">Graphics object to print on.</param> /// <param name="bounds">Bounds of the area to print within.</param> protected override void DoPrint( ReportDocument reportDocument, Graphics g, Bounds bounds ) { SizeF mySize = new SizeF (0,0); if (ShowDividerFirst && (Divider != null)) { divider.Print (reportDocument, g, bounds); AdvancePointers (divider.Size, ref bounds, ref mySize); } // size first SectionSizeValues oneCall = SizePrintLine (reportDocument, g, bounds, true, false); bool fits = oneCall.Fits; while (oneCall.Fits) { Bounds printBounds = bounds.GetBounds (oneCall.RequiredSize); SizePrintLine (reportDocument, g, printBounds, false, true); // print AdvancePointers (oneCall.RequiredSize, ref bounds, ref mySize); // if this section is not continued, quit now // or if this was the last column/row on this page, quit now if (!oneCall.Continued || bounds.IsEmpty()) { break; } oneCall = SizePrintLine (reportDocument, g, bounds, true, false); // size if ( oneCall.Fits && Divider != null) { divider.Print (reportDocument, g, bounds); AdvancePointers (divider.Size, ref bounds, ref mySize); } } SetSize (mySize, bounds); SetFits (fits); SetContinued (oneCall.Continued); }