本文整理匯總了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);
}
}
}