当前位置: 首页>>代码示例>>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;未经允许,请勿转载。