本文整理匯總了C#中iTextSharp.text.Rectangle.GetRectangle方法的典型用法代碼示例。如果您正苦於以下問題:C# Rectangle.GetRectangle方法的具體用法?C# Rectangle.GetRectangle怎麽用?C# Rectangle.GetRectangle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.Rectangle
的用法示例。
在下文中一共展示了Rectangle.GetRectangle方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AddPdfTable
/**
* Adds a new table to
* @param table Table to add. Rendered rows will be deleted after processing.
* @param onlyFirstPage Render only the first full page
* @throws DocumentException
*/
private void AddPdfTable(Table t)
{
// before every table, we flush all lines
FlushLines();
PdfTable table = new PdfTable(t, IndentLeft, IndentRight, IndentTop - currentHeight);
RenderingContext ctx = new RenderingContext();
ctx.pagetop = IndentTop;
ctx.oldHeight = currentHeight;
ctx.cellGraphics = new PdfContentByte(writer);
ctx.rowspanMap = new Hashtable();
ctx.table = table;
// initialisation of parameters
PdfCell cell;
// drawing the table
ArrayList headercells = table.HeaderCells;
ArrayList cells = table.Cells;
ArrayList rows = ExtractRows(cells, ctx);
bool isContinue = false;
while (cells.Count != 0) {
// initialisation of some extra parameters;
ctx.lostTableBottom = 0;
// loop over the cells
bool cellsShown = false;
// draw the cells (line by line)
ListIterator iterator = new ListIterator(rows);
bool atLeastOneFits = false;
while (iterator.HasNext()) {
ArrayList row = (ArrayList) iterator.Next();
AnalyzeRow(rows, ctx);
RenderCells(ctx, row, table.HasToFitPageCells() & atLeastOneFits);
if (!MayBeRemoved(row)) {
break;
}
ConsumeRowspan(row, ctx);
iterator.Remove();
atLeastOneFits = true;
}
// compose cells array list for subsequent code
cells.Clear();
Hashtable opt = new Hashtable();
foreach (ArrayList row in rows) {
foreach (PdfCell cellp in row) {
if (!opt.ContainsKey(cellp)) {
cells.Add(cellp);
opt[cellp] = null;
}
}
}
// we paint the graphics of the table after looping through all the cells
Rectangle tablerec = new Rectangle(table);
tablerec.Border = table.Border;
tablerec.BorderWidth = table.BorderWidth;
tablerec.BorderColor = table.BorderColor;
tablerec.BackgroundColor = table.BackgroundColor;
PdfContentByte under = writer.DirectContentUnder;
under.Rectangle(tablerec.GetRectangle(Top, IndentBottom));
under.Add(ctx.cellGraphics);
// bugfix by Gerald Fehringer: now again add the border for the table
// since it might have been covered by cell backgrounds
tablerec.BackgroundColor = null;
tablerec = tablerec.GetRectangle(Top, IndentBottom);
tablerec.Border = table.Border;
under.Rectangle(tablerec);
// end bugfix
ctx.cellGraphics = new PdfContentByte(null);
// if the table continues on the next page
if (rows.Count != 0) {
isContinue = true;
graphics.SetLineWidth(table.BorderWidth);
if (cellsShown && (table.Border & Rectangle.BOTTOM_BORDER) == Rectangle.BOTTOM_BORDER) {
// Draw the bottom line
// the color is set to the color of the element
Color tColor = table.BorderColor;
if (tColor != null) {
graphics.SetColorStroke(tColor);
}
graphics.MoveTo(table.Left, Math.Max(table.Bottom, IndentBottom));
graphics.LineTo(table.Right, Math.Max(table.Bottom, IndentBottom));
graphics.Stroke();
if (tColor != null) {
graphics.ResetRGBColorStroke();
}
}
//.........這裏部分代碼省略.........