本文整理汇总了C#中PdfSharp.Drawing.XRect.Offset方法的典型用法代码示例。如果您正苦于以下问题:C# XRect.Offset方法的具体用法?C# XRect.Offset怎么用?C# XRect.Offset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PdfSharp.Drawing.XRect
的用法示例。
在下文中一共展示了XRect.Offset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawTitle
/// <summary>
/// Draws the page title and footer.
/// </summary>
public void DrawTitle(PdfPage page, XGraphics gfx, string title)
{
XRect rect = new XRect(new XPoint(), gfx.PageSize);
rect.Inflate(-10, -15);
XFont font = new XFont("Verdana", 14, XFontStyle.Bold);
gfx.DrawString(title, font, XBrushes.MidnightBlue, rect, XStringFormats.TopCenter);
rect.Offset(0, 5);
font = new XFont("Verdana", 8, XFontStyle.Italic);
XStringFormat format = new XStringFormat();
format.Alignment = XStringAlignment.Near;
format.LineAlignment = XLineAlignment.Far;
gfx.DrawString("Created with " + PdfSharp.ProductVersionInfo.Producer, font, XBrushes.DarkOrchid, rect, format);
font = new XFont("Verdana", 8);
format.Alignment = XStringAlignment.Center;
gfx.DrawString(Program.s_document.PageCount.ToString(), font, XBrushes.DarkOrchid, rect, format);
Program.s_document.Outlines.Add(title, page, true);
}
示例2: Offset
/// <summary>
/// Returns a rectangle that is offset from the specified rectangle by using specified horizontal and vertical amounts.
/// </summary>
public static XRect Offset(XRect rect, double offsetX, double offsetY)
{
rect.Offset(offsetX, offsetY);
return rect;
}
示例3: CreatePage
private void CreatePage(PdfDocument doc, string firstWord, string secondWord, string color)
{
var page = doc.AddPage();
page.Size = PdfSharp.PageSize.A4;
XRect topHalf = new XRect(20, 20, page.Width - 40, (page.Height / 2) - 30);
XRect bottomHalf = new XRect(topHalf.TopLeft, topHalf.BottomRight);
bottomHalf.Offset(0, page.Height / 2 - 15);
using (XGraphics gfx = XGraphics.FromPdfPage(page))
{
if (string.IsNullOrWhiteSpace(firstWord) == false)
{
DrawCorners(topHalf, gfx);
DrawWord(firstWord, gfx, topHalf, color);
}
if (string.IsNullOrWhiteSpace(secondWord) == false)
{
DrawCorners(bottomHalf, gfx);
DrawWord(secondWord, gfx, bottomHalf, color);
}
}
}