本文整理汇总了C#中PdfSharp.Drawing.XUnit类的典型用法代码示例。如果您正苦于以下问题:C# XUnit类的具体用法?C# XUnit怎么用?C# XUnit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XUnit类属于PdfSharp.Drawing命名空间,在下文中一共展示了XUnit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewPage
public static XGraphics NewPage(PdfDocument document, XUnit width, XUnit height)
{
var page = document.AddPage();
page.Width = width;
page.Height = height;
return XGraphics.FromPdfPage(page);
}
示例2: Render
internal void Render(XUnit x, XUnit y, XUnit width, XUnit height)
{
if (_shading == null || _brush == null)
return;
_gfx.DrawRectangle(_brush, x.Point, y.Point, width.Point, height.Point);
}
示例3: MarginMax
/// <summary>
/// Returns the max of the given Margins, if both are positive or 0, the sum otherwise.
/// </summary>
/// <param name="prevBottomMargin">The bottom margin of the previous element.</param>
/// <param name="nextTopMargin">The top margin of the next element.</param>
/// <returns></returns>
private XUnit MarginMax(XUnit prevBottomMargin, XUnit nextTopMargin)
{
if (prevBottomMargin >= 0 && nextTopMargin >= 0)
return Math.Max(prevBottomMargin, nextTopMargin);
else
return prevBottomMargin + nextTopMargin;
}
示例4: Cell
public Cell(string text, XUnit width, XFont font, Alignment alignment)
{
this.Text = text;
this.width = width;
this.font = font;
this.alignment = alignment;
this.height = XUnit.Zero;
}
示例5: PDFLayoutHelper
/// <summary>
/// Constructor
/// </summary>
/// <param name="document">Pdf Document object</param>
/// <param name="topPosition">Top positon for the PDF write start position</param>
/// <param name="bottomMargin">Bottom margin for the PDF</param>
public PDFLayoutHelper(PdfDocument document, XUnit topPosition, XUnit bottomMargin)
{
_document = document;
_topPosition = topPosition;
_bottomMargin = bottomMargin;
// Set a value outside the page - a new page will be created on the first request.
_currentPosition = bottomMargin + 10000;
}
示例6: Render
internal void Render(XUnit xPosition, XUnit yPosition, XUnit width, XUnit height)
{
XUnit lineWidth = GetWidth();
if (lineWidth > 0)
{
XPen pen = GetPen(lineWidth);
_gfx.DrawRectangle(pen, xPosition, yPosition, width, height);
}
}
示例7: FormattedCell
internal FormattedCell(Cell cell, DocumentRenderer documentRenderer, Borders cellBorders, FieldInfos fieldInfos, XUnit xOffset, XUnit yOffset)
{
this.cell = cell;
this.fieldInfos = fieldInfos;
this.yOffset = yOffset;
this.xOffset = xOffset;
this.bordersRenderer = new BordersRenderer(cellBorders, null);
this.documentRenderer = documentRenderer;
}
示例8: Render
internal void Render(XUnit x, XUnit y, XUnit width, XUnit height)
{
XBrush brush = GetBrush();
if (brush == null)
return;
this.gfx.DrawRectangle(brush, x.Point, y.Point, width.Point, height.Point);
}
示例9: FormattedCell
internal FormattedCell(Cell cell, DocumentRenderer documentRenderer, Borders cellBorders, FieldInfos fieldInfos, XUnit xOffset, XUnit yOffset)
{
_cell = cell;
_fieldInfos = fieldInfos;
_yOffset = yOffset;
_xOffset = xOffset;
_bordersRenderer = new BordersRenderer(cellBorders, null);
_documentRenderer = documentRenderer;
}
示例10: GetLinePosition
/// <summary>
/// Get line positon for current write position
/// </summary>
/// <param name="requestedHeight">Requested height for next line</param>
/// <param name="requiredHeight">Required height for next line</param>
/// <returns></returns>
public XUnit GetLinePosition(XUnit requestedHeight, XUnit requiredHeight)
{
XUnit required = requiredHeight == -1f ? requestedHeight : requiredHeight;
// Check if new line position will exceed the page limit, if then create a new page
if (_currentPosition + required > _bottomMargin)
CreatePage();
XUnit result = _currentPosition;
_currentPosition += requestedHeight;
return result;
}
示例11: GetFormattedTextArea
FormattedTextArea GetFormattedTextArea(TextArea area, XUnit width)
{
if (area == null)
return null;
FormattedTextArea formattedTextArea = new FormattedTextArea(_documentRenderer, area, _fieldInfos);
if (!double.IsNaN(width))
formattedTextArea.InnerWidth = width;
formattedTextArea.Format(_gfx);
return formattedTextArea;
}
示例12: GetLeftRightVerticalPosition
void GetLeftRightVerticalPosition(out XUnit top, out XUnit bottom)
{
//REM: Line width is still ignored while layouting charts.
Area contentArea = _renderInfo.LayoutInfo.ContentArea;
ChartFormatInfo formatInfo = (ChartFormatInfo)_renderInfo.FormatInfo;
top = contentArea.Y;
if (formatInfo.FormattedHeader != null)
top += formatInfo.FormattedHeader.InnerHeight;
bottom = contentArea.Y + contentArea.Height;
if (formatInfo.FormattedFooter != null)
bottom -= formatInfo.FormattedFooter.InnerHeight;
}
示例13: RenderByInfos
/// <summary>
/// Renders the contents shifted to the given Coordinates.
/// </summary>
/// <param name="xShift">The x shift.</param>
/// <param name="yShift">The y shift.</param>
/// <param name="renderInfos">The render infos.</param>
protected void RenderByInfos(XUnit xShift, XUnit yShift, RenderInfo[] renderInfos)
{
if (renderInfos == null)
return;
foreach (RenderInfo renderInfo in renderInfos)
{
XUnit savedX = renderInfo.LayoutInfo.ContentArea.X;
XUnit savedY = renderInfo.LayoutInfo.ContentArea.Y;
renderInfo.LayoutInfo.ContentArea.X += xShift;
renderInfo.LayoutInfo.ContentArea.Y += yShift;
Renderer renderer = Create(_gfx, _documentRenderer, renderInfo, _fieldInfos);
renderer.Render();
renderInfo.LayoutInfo.ContentArea.X = savedX;
renderInfo.LayoutInfo.ContentArea.Y = savedY;
}
}
示例14: GetPen
XPen GetPen(XUnit width)
{
if (width == 0)
return null;
XPen pen = new XPen(GetColor(), width);
switch (_lineFormat.DashStyle)
{
case DashStyle.Dash:
pen.DashStyle = XDashStyle.Dash;
break;
case DashStyle.DashDot:
pen.DashStyle = XDashStyle.DashDot;
break;
case DashStyle.DashDotDot:
pen.DashStyle = XDashStyle.DashDotDot;
break;
case DashStyle.Solid:
pen.DashStyle = XDashStyle.Solid;
break;
case DashStyle.SquareDot:
pen.DashStyle = XDashStyle.Dot;
break;
}
return pen;
}
示例15: SaveBeforeProbing
void SaveBeforeProbing(out ParagraphIterator paragraphIter, out int blankCount, out XUnit wordsWidth, out XUnit xPosition, out XUnit lineWidth, out XUnit blankWidth)
{
paragraphIter = this.currentLeaf;
blankCount = this.currentBlankCount;
xPosition = this.currentXPosition;
lineWidth = this.currentLineWidth;
wordsWidth = this.currentWordsWidth;
blankWidth = this.savedBlankWidth;
}