當前位置: 首頁>>代碼示例>>C#>>正文


C# XRect.Offset方法代碼示例

本文整理匯總了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);
    }
開發者ID:bossaia,項目名稱:alexandrialibrary,代碼行數:23,代碼來源:Base.cs

示例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;
 }
開發者ID:AnthonyNystrom,項目名稱:Pikling,代碼行數:8,代碼來源:XRect.cs

示例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);
                }
            }
        }
開發者ID:marto83,項目名稱:flashcardgenerator,代碼行數:23,代碼來源:HomeController.cs


注:本文中的PdfSharp.Drawing.XRect.Offset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。