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


C# XGraphicsPath.AddRoundedRectangle方法代碼示例

本文整理匯總了C#中PdfSharp.Drawing.XGraphicsPath.AddRoundedRectangle方法的典型用法代碼示例。如果您正苦於以下問題:C# XGraphicsPath.AddRoundedRectangle方法的具體用法?C# XGraphicsPath.AddRoundedRectangle怎麽用?C# XGraphicsPath.AddRoundedRectangle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PdfSharp.Drawing.XGraphicsPath的用法示例。


在下文中一共展示了XGraphicsPath.AddRoundedRectangle方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DrawRoundedRectangle

    /// <summary>
    /// Draws a rectangles with round corners.
    /// </summary>
    public void DrawRoundedRectangle(XPen pen, XBrush brush, double x, double y, double width, double height,
      double ellipseWidth, double ellipseHeight)
    {
      if (pen == null && brush == null)
        throw new ArgumentNullException("pen and brush", PSSR.NeedPenOrBrush);

      if (this.drawGraphics)
      {
#if GDI
        if (this.targetContext == XGraphicTargetContext.GDI)
        {
          XGraphicsPath path = new XGraphicsPath();
          path.AddRoundedRectangle(x, y, width, height, ellipseWidth, ellipseHeight);
          DrawPath(pen, brush, path);
        }
#endif
#if WPF
        if (this.targetContext == XGraphicTargetContext.WPF)
        {
          this.dc.DrawRoundedRectangle(
            brush != null ? brush.RealizeWpfBrush() : null,
            pen != null ? pen.RealizeWpfPen() : null,
            new Rect(x, y, width, height), ellipseWidth / 2, ellipseHeight / 2);
        }
#endif
      }

      if (this.renderer != null)
        this.renderer.DrawRoundedRectangle(pen, brush, x, y, width, height, ellipseWidth, ellipseHeight);
    }
開發者ID:Davincier,項目名稱:openpetra,代碼行數:33,代碼來源:XGraphics.cs

示例2: DrawRoundedRectangle

    /// <summary>
    /// Draws a rectangles with round corners.
    /// </summary>
    public void DrawRoundedRectangle(XPen pen, XBrush brush, double x, double y, double width, double height,
      double ellipseWidth, double ellipseHeight)
    {
      if (pen == null && brush == null)
        throw new ArgumentNullException("pen and brush", PSSR.NeedPenOrBrush);


      if (this.drawGraphics)
      {
        XGraphicsPath path = new XGraphicsPath();
        path.AddRoundedRectangle(x, y, width, height, ellipseWidth, ellipseHeight);
        DrawPath(pen, brush, path);

        //GraphicsPath gdiPath = path.RealizeGdiPath();
        //if (brush != null)
        //  this.gfx.FillPath(brush.RealizeGdiBrush(), gdiPath);
        //if (pen != null)
        //  this.gfx.DrawPath(pen.RealizeGdiPen(), gdiPath);
      }
      if (this.renderer != null)
        this.renderer.DrawRoundedRectangle(pen, brush, x, y, width, height, ellipseWidth, ellipseHeight);
    }
開發者ID:BackupTheBerlios,項目名稱:zp7-svn,代碼行數:25,代碼來源:XGraphics.cs


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