当前位置: 首页>>代码示例>>C#>>正文


C# Rectangle.CloneNonPositionParameters方法代码示例

本文整理汇总了C#中iTextSharp.text.Rectangle.CloneNonPositionParameters方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.CloneNonPositionParameters方法的具体用法?C# Rectangle.CloneNonPositionParameters怎么用?C# Rectangle.CloneNonPositionParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iTextSharp.text.Rectangle的用法示例。


在下文中一共展示了Rectangle.CloneNonPositionParameters方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteBorderAndBackground

        /**
        * Writes the border and background of one cell in the row.
        *
        * @param xPos The x-coordinate where the table starts on the canvas
        * @param yPos The y-coordinate where the table starts on the canvas
        * @param currentMaxHeight The height of the cell to be drawn.
        * @param cell
        * @param canvases
        * @since    2.1.6   extra parameter currentMaxHeight
        */
        public void WriteBorderAndBackground(float xPos, float yPos, float currentMaxHeight, PdfPCell cell, PdfContentByte[] canvases)
        {
            BaseColor background = cell.BackgroundColor;
            if (background != null || cell.HasBorders()) {
                // Add xPos resp. yPos to the cell's coordinates for absolute coordinates
                float right = cell.Right + xPos;
                float top = cell.Top + yPos;
                float left = cell.Left + xPos;
                float bottom = top - currentMaxHeight;

                if (background != null) {
                    PdfContentByte backgr = canvases[PdfPTable.BACKGROUNDCANVAS];
                    backgr.SetColorFill(background);
                    backgr.Rectangle(left, bottom, right - left, top - bottom);
                    backgr.Fill();
                }
                if (cell.HasBorders()) {
                    Rectangle newRect = new Rectangle(left, bottom, right, top);
                    // Clone non-position parameters except for the background color
                    newRect.CloneNonPositionParameters(cell);
                    newRect.BackgroundColor = null;
                    // Write the borders on the line canvas
                    PdfContentByte lineCanvas = canvases[PdfPTable.LINECANVAS];
                    lineCanvas.Rectangle(newRect);
                }
            }
        }
开发者ID:boecko,项目名称:iTextSharp,代码行数:37,代码来源:PdfPRow.cs

示例2: CellLayout

 /**
 * @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell, com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
 */
 public void CellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) {
     float sp_left = spacing_left;
     if (float.IsNaN(sp_left)) sp_left = 0f;
     float sp_right = spacing_right;
     if (float.IsNaN(sp_right)) sp_right = 0f;
     float sp_top = spacing_top;
     if (float.IsNaN(sp_top)) sp_top = 0f;
     float sp_bottom = spacing_bottom;
     if (float.IsNaN(sp_bottom)) sp_bottom = 0f;
     Rectangle rect = new Rectangle(position.GetLeft(sp_left), position.GetBottom(sp_bottom), position.GetRight(sp_right), position.GetTop(sp_top));
     rect.CloneNonPositionParameters(this);
     canvases[PdfPTable.BACKGROUNDCANVAS].Rectangle(rect);
     rect.BackgroundColor = null;
     canvases[PdfPTable.LINECANVAS].Rectangle(rect);
 }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:18,代码来源:SimpleCell.cs

示例3: Rectangle

 /**
 * Gets a Rectangle that is altered to fit on the page.
 *
 * @param    top     the top position
 * @param    bottom  the bottom position
 * @return   a <CODE>Rectangle</CODE>
 */
 public Rectangle Rectangle(float top, float bottom)
 {
     Rectangle tmp = new Rectangle(Left, Bottom, Right, Top);
     tmp.CloneNonPositionParameters(this);
     if (Top > top) {
         tmp.Top = top;
         tmp.Border = border - (border & TOP_BORDER);
     }
     if (Bottom < bottom) {
         tmp.Bottom = bottom;
         tmp.Border = border - (border & BOTTOM_BORDER);
     }
     return tmp;
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:21,代码来源:PdfCell.cs

示例4: WriteBorderAndBackground

        /**
        * Writes the border and background of one cell in the row.
        * @param xPos
        * @param yPos
        * @param cell
        * @param canvases
        */
        public void WriteBorderAndBackground(float xPos, float yPos, PdfPCell cell,
                PdfContentByte[] canvases)
        {
            PdfContentByte lines = canvases[PdfPTable.LINECANVAS];
            PdfContentByte backgr = canvases[PdfPTable.BACKGROUNDCANVAS];
            // the coordinates of the border are retrieved
            float x1 = cell.Left + xPos;
            float y2 = cell.Top + yPos;
            float x2 = cell.Right + xPos;
            float y1 = y2 - maxHeight;

            // the backgroundcolor is set
            Color background = cell.BackgroundColor;
            if (background != null) {
                backgr.SetColorFill(background);
                backgr.Rectangle(x1, y1, x2 - x1, y2 - y1);
                backgr.Fill();
            }
            // if the element hasn't got any borders, nothing is added
            if (cell.HasBorders()) {
                if (cell.UseVariableBorders) {
                    Rectangle borderRect = new Rectangle(cell.Left + xPos, cell.Top
                            - maxHeight + yPos, cell.Right + xPos, cell.Top
                            + yPos);
                    borderRect.CloneNonPositionParameters(cell);
                    borderRect.BackgroundColor = null;
                    lines.Rectangle(borderRect);
                } else {
                    // the width is set to the width of the element
                    if (cell.BorderWidth != Rectangle.UNDEFINED) {
                        lines.SetLineWidth(cell.BorderWidth);
                    }
                    // the color is set to the color of the element
                    Color color = cell.BorderColor;
                    if (color != null) {
                        lines.SetColorStroke(color);
                    }

                    // if the box is a rectangle, it is added as a rectangle
                    if (cell.HasBorder(Rectangle.BOX)) {
                        lines.Rectangle(x1, y1, x2 - x1, y2 - y1);
                    }
                    // if the border isn't a rectangle, the different sides are
                    // added apart
                    else {
                        if (cell.HasBorder(Rectangle.RIGHT_BORDER)) {
                            lines.MoveTo(x2, y1);
                            lines.LineTo(x2, y2);
                        }
                        if (cell.HasBorder(Rectangle.LEFT_BORDER)) {
                            lines.MoveTo(x1, y1);
                            lines.LineTo(x1, y2);
                        }
                        if (cell.HasBorder(Rectangle.BOTTOM_BORDER)) {
                            lines.MoveTo(x1, y1);
                            lines.LineTo(x2, y1);
                        }
                        if (cell.HasBorder(Rectangle.TOP_BORDER)) {
                            lines.MoveTo(x1, y2);
                            lines.LineTo(x2, y2);
                        }
                    }
                    lines.Stroke();
                    if (color != null) {
                        lines.ResetRGBColorStroke();
                    }
                }
            }
        }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:76,代码来源:PdfPRow.cs

示例5: TableLayout

 /**
 * @see com.lowagie.text.pdf.PdfPTableEvent#tableLayout(com.lowagie.text.pdf.PdfPTable, float[][], float[], int, int, com.lowagie.text.pdf.PdfContentByte[])
  */
 public void TableLayout(PdfPTable table, float[][] widths, float[] heights, int headerRows, int rowStart, PdfContentByte[] canvases)
 {
     float[] width = widths[0];
     Rectangle rect = new Rectangle(width[0], heights[heights.Length - 1], width[width.Length - 1], heights[0]);
     rect.CloneNonPositionParameters(this);
     int bd = rect.Border;
     rect.Border = Rectangle.NO_BORDER;
     canvases[PdfPTable.BACKGROUNDCANVAS].Rectangle(rect);
     rect.Border = bd;
     rect.BackgroundColor = null;
     canvases[PdfPTable.LINECANVAS].Rectangle(rect);
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:15,代码来源:SimpleTable.cs


注:本文中的iTextSharp.text.Rectangle.CloneNonPositionParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。