Beispiel #1
0
        /// <summary>
        /// Notification that the bounds has changed between
        /// the size and the print.
        /// Override this function to update anything based on the new location
        /// </summary>
        /// <param name="originalBounds">Bounds originally passed for sizing</param>
        /// <param name="newBounds">New bounds for printing</param>
        /// <returns>New required size</returns>
        protected override SectionSizeValues BoundsChanged(
            Bounds originalBounds,
            Bounds newBounds)
        {
            // Find the cases where a resizing is not-necessary.
            // For now, we can handle a change in the size of the
            // bounds as long as the placement doesn't change relative to
            // our "aligned" corner, and the size is still big enough.
            bool resize = true;
            int  corner = GetOrigin();

            if (corner > 0)
            {
                if (GetPoint(originalBounds, corner) == GetPoint(newBounds, corner))
                {
                    if (newBounds.SizeFits(this.RequiredSize))
                    {
                        resize = false;
                    }
                }
            }

            if (resize)
            {
                this.ResetSize();
            }
            return(base.BoundsChanged(originalBounds, newBounds));
        }
Beispiel #2
0
        /// <summary>
        /// This method is called after a size and before a print if
        /// the bounds have changed between the sizing and the printing.
        /// Override this function to update anything based on the new location
        /// </summary>
        /// <param name="originalBounds">Bounds originally passed for sizing</param>
        /// <param name="newBounds">New bounds for printing</param>
        /// <returns>SectionSizeValues for the new values of size, fits, continued</returns>
        /// <remarks>To simply have size recalled, implement the following:
        /// <code>
        ///    this.ResetSize();
        ///    return base.ChangeBounds (originalBounds, newBounds);
        /// </code>
        /// </remarks>
        protected override SectionSizeValues BoundsChanged(
            Bounds originalBounds,
            Bounds newBounds)
        {
            SectionSizeValues retval = new SectionSizeValues();

            this.imageRect      = GetImageRect(newBounds);
            retval.RequiredSize = this.imageRect.Size;
            retval.Fits         = newBounds.SizeFits(retval.RequiredSize);
            retval.Continued    = false;
            return(retval);
        }
Beispiel #3
0
        /// <summary>
        /// Called to calculate the size that this section requires on
        /// the next call to Print.  This method will be called once
        /// prior to each call to Print.
        /// </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.
        /// The bounds passed already takes the margins into account - so you cannot
        /// print or do anything within these margins.
        /// </param>
        /// <returns>The values for RequireSize, Fits and Continues for this section.</returns>
        protected override SectionSizeValues DoCalcSize(
            ReportDocument reportDocument,
            Graphics g,
            Bounds bounds
            )
        {
            SectionSizeValues retval = new SectionSizeValues();

            this.imageRect      = GetImageRect(bounds);
            retval.RequiredSize = this.imageRect.Size;
            retval.Fits         = bounds.SizeFits(retval.RequiredSize);
            retval.Continued    = false;
            return(retval);
        }
Beispiel #4
0
        /// <summary>
        /// Sizes rows and figures out how many will fit in the given bounds.
        /// </summary>
        /// <param name="g">Graphics object used for measuring</param>
        /// <param name="bounds">Maximum bounds allowed for table</param>
        /// <returns>The number of data rows that will fit</returns>
        int FindDataRowsFit(Graphics g, ref Bounds bounds)
        {
            int rowsThatFit = 0;
            int index       = this.rowIndex;

            rowHeights = new ArrayList();
            // Find the rows that fit...
            while (index < this.TotalRows)
            {
                bool  includeRowLine = index < TotalRows - 1;
                float rowHeight      = SizePrintRow(g, index, bounds.Position.X,
                                                    bounds.Position.Y, bounds.Width, this.MaxDetailRowHeight,
                                                    true, includeRowLine);
                if (bounds.SizeFits(new SizeF(GetPageInfo().Width, rowHeight)))
                {
                    Debug.Assert(rowHeights.Count == rowsThatFit, "rowHeights.Count is not equal to index");
                    rowHeights.Add(rowHeight);
                    bounds.Position.Y += rowHeight;
                    index++;
                    rowsThatFit++;
                }
                else
                {
                    if (rowHeights.Count > 0)
                    {
                        // oops, it doesn't fit.. we'll resize
                        // the last row without the line.
                        rowHeight = SizePrintRow(g, index - 1, bounds.Position.X,
                                                 bounds.Position.Y, bounds.Width, this.MaxDetailRowHeight,
                                                 true, false);

                        bounds.Position.Y -= ((float)rowHeights[rowHeights.Count - 1]);
                        bounds.Position.Y += rowHeight;
                        rowHeights[rowHeights.Count - 1] = rowHeight;
                    }
                    break;
                }
            }
            return(rowsThatFit);
        }
Beispiel #5
0
        /// <summary>
        /// Sizes or prints the header, if it is enabled
        /// </summary>
        /// <param name="g"></param>
        /// <param name="bounds"></param>
        /// <param name="sizeOnly"></param>
        /// <returns>True if it fits, false if it doesn't</returns>
        bool SizePrintHeader(Graphics g, ref Bounds bounds, bool sizeOnly)
        {
            bool headerFits = true;

            if (!this.SuppressHeaderRow && this.RepeatHeaderRow)
            {
                // if it fits, print it
                if (bounds.SizeFits(this.HeaderSize))
                {
                    if (!sizeOnly)
                    {
                        SizePrintRow(g, HeaderRowNumber, bounds.Position.X, bounds.Position.Y,
                                     this.GetPageInfo().Width, this.headerRowHeight, false, false);
                    }
                    bounds.Position.Y += this.headerRowHeight;
                }
                else
                {
                    headerFits = false;
                }
            }
            return(headerFits);
        }
Beispiel #6
0
        /// <summary>
        /// Notification that the bounds has changed between
        /// the size and the print.  
        /// Override this function to update anything based on the new location
        /// </summary>
        /// <param name="originalBounds">Bounds originally passed for sizing</param>
        /// <param name="newBounds">New bounds for printing</param>
        /// <returns>New required size</returns>
        protected override SectionSizeValues BoundsChanged(
            Bounds originalBounds,
            Bounds newBounds)
        {
            // Find the cases where a resizing is not-necessary.
            // For now, we can handle a change in the size of the
            // bounds as long as the placement doesn't change relative to
            // our "aligned" corner, and the size is still big enough.
            bool resize = true;
            int corner = GetOrigin();
            if (corner >= 0)
            {
                if (GetPoint(originalBounds, corner) == GetPoint(newBounds, corner))
                {
                    if (newBounds.SizeFits(this.RequiredSize))
                    {
                        resize = false;
                    }
                }
            }

            if (resize)
            {
                this.ResetSize();
            }
            return base.BoundsChanged (originalBounds, newBounds);
        }
Beispiel #7
0
 /// <summary>
 /// Sizes or prints the header, if it is enabled
 /// </summary>
 /// <param name="g"></param>
 /// <param name="bounds"></param>
 /// <param name="sizeOnly"></param>
 /// <returns>True if it fits, false if it doesn't</returns>
 bool SizePrintHeader(Graphics g, ref Bounds bounds, bool sizeOnly)
 {
     bool headerFits = true;
     if (!this.SuppressHeaderRow && this.RepeatHeaderRow)
     {
         // if it fits, print it
         if (bounds.SizeFits(this.HeaderSize))
         {
             if (!sizeOnly)
             {
                 SizePrintRow (g, HeaderRowNumber, bounds.Position.X, bounds.Position.Y,
                     this.GetPageInfo().Width, this.headerRowHeight, false, false);
             }
             bounds.Position.Y += this.headerRowHeight;
         }
         else
         {
             headerFits = false;
         }
     }
     return headerFits;
 }
Beispiel #8
0
        /// <summary>
        /// Sizes rows and figures out how many will fit in the given bounds.
        /// </summary>
        /// <param name="g">Graphics object used for measuring</param>
        /// <param name="bounds">Maximum bounds allowed for table</param>
        /// <returns>The number of data rows that will fit</returns>
        int FindDataRowsFit(Graphics g, ref Bounds bounds)
        {
            int rowsThatFit = 0;
            int index = this.rowIndex;
            rowHeights = new ArrayList();
            // Find the rows that fit...
            while (index < this.TotalRows)
            {
                bool includeRowLine = index < TotalRows - 1;
                float rowHeight = SizePrintRow (g, index, bounds.Position.X,
                    bounds.Position.Y,  bounds.Width, this.MaxDetailRowHeight,
                    true, includeRowLine);
                if (bounds.SizeFits(new SizeF (GetPageInfo().Width, rowHeight)))
                {
                    Debug.Assert (rowHeights.Count == rowsThatFit, "rowHeights.Count is not equal to index");
                    rowHeights.Add (rowHeight);
                    bounds.Position.Y += rowHeight;
                    index++;
                    rowsThatFit++;
                }
                else
                {
                    if (rowHeights.Count > 0)
                    {
                        // oops, it doesn't fit.. we'll resize
                        // the last row without the line.
                        rowHeight = SizePrintRow (g, index - 1, bounds.Position.X,
                            bounds.Position.Y,  bounds.Width, this.MaxDetailRowHeight,
                            true, false);

                        bounds.Position.Y -= ((float)rowHeights[rowHeights.Count - 1]);
                        bounds.Position.Y += rowHeight;
                        rowHeights[rowHeights.Count - 1] = rowHeight;
                    }
                    break;
                }
            }
            return rowsThatFit;
        }
Beispiel #9
0
 /// <summary>
 /// Called to calculate the size that this section requires on
 /// the next call to Print.  This method will be called once
 /// prior to each call to Print.  
 /// </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.
 /// The bounds passed already takes the margins into account - so you cannot
 /// print or do anything within these margins.
 /// </param>
 /// <returns>The values for RequireSize, Fits and Continues for this section.</returns>
 protected override SectionSizeValues DoCalcSize(
     ReportDocument reportDocument,
     Graphics g,
     Bounds bounds
     )
 {
     SectionSizeValues retval = new SectionSizeValues();
     this.imageRect = GetImageRect(bounds);
     retval.RequiredSize = this.imageRect.Size;
     retval.Fits = bounds.SizeFits(retval.RequiredSize);
     retval.Continued = false;
     return retval;
 }
Beispiel #10
0
 /// <summary>
 /// This method is called after a size and before a print if
 /// the bounds have changed between the sizing and the printing.
 /// Override this function to update anything based on the new location
 /// </summary>
 /// <param name="originalBounds">Bounds originally passed for sizing</param>
 /// <param name="newBounds">New bounds for printing</param>
 /// <returns>SectionSizeValues for the new values of size, fits, continued</returns>
 /// <remarks>To simply have size recalled, implement the following:
 /// <code>
 ///    this.ResetSize();
 ///    return base.ChangeBounds (originalBounds, newBounds);
 /// </code>
 /// </remarks>
 protected override SectionSizeValues BoundsChanged(
     Bounds originalBounds,
     Bounds newBounds)
 {
     SectionSizeValues retval = new SectionSizeValues();
     this.imageRect = GetImageRect(newBounds);
     retval.RequiredSize = this.imageRect.Size;
     retval.Fits = newBounds.SizeFits(retval.RequiredSize);
     retval.Continued = false;
     return retval;
 }
Beispiel #11
0
        /// <summary>
        /// Sizes rows and figures out how many will fit in the given bounds.
        /// </summary>
        /// <param name="g">Graphics object used for measuring</param>
        /// <param name="bounds">Maximum bounds allowed for table</param>
        /// <returns>The number of data rows that will fit</returns>
        int FindDataRowsFit(Graphics g, ref Bounds bounds)
        {
            int rowsThatFit = 0;
            int index = this.rowIndex;
            rowHeights = new ArrayList();
            // Find the rows that fit...
            while (index < this.TotalRows)
            {
                bool includeRowLine = index < TotalRows - 1;
                float rowHeight = SizePrintRow (g, index, bounds.Position.X,
                    bounds.Position.Y,  bounds.Width, this.MaxDetailRowHeight,
                    true, includeRowLine);
                if (bounds.SizeFits(new SizeF (GetPageInfo().Width, rowHeight)))
                {
                    Debug.Assert (rowHeights.Count == rowsThatFit, "rowHeights.Count is not equal to index");
                    rowHeights.Add (rowHeight);
                    bounds.Position.Y += rowHeight;
                    index++;
                    rowsThatFit++;
                }
                else
                {
                    if (rowHeights.Count > 0)
                    {
                        // oops, it doesn't fit.. we'll resize
                        // the last row without the line.
                        rowHeight = SizePrintRow (g, index - 1, bounds.Position.X,
                            bounds.Position.Y,  bounds.Width, this.MaxDetailRowHeight,
                            true, false);

                        bounds.Position.Y -= ((float)rowHeights[rowHeights.Count - 1]);
                        bounds.Position.Y += rowHeight;
                        rowHeights[rowHeights.Count - 1] = rowHeight;
                    }
                    break;
                }
            }
            if (minDataRowsFit != 0 && index < this.TotalRows)
            {
                if (rowsThatFit < minDataRowsFit)
                    rowsThatFit = 0;
                else // make sure at least minDataRowsFit rows are left for the next page
                {
                    int rowsLeft = this.TotalRows - index - ((this.ShowSummaryRow) ? 1 : 0);
                    if (rowsLeft + rowsThatFit < (2 * minDataRowsFit))
                        rowsThatFit = 0; // Force all onto next page
                    else if(minDataRowsFit > rowsLeft)
                        rowsThatFit -= (minDataRowsFit - rowsLeft); // Leave enough for next page.
                }
            }
            return rowsThatFit;
        }