PdfSharp.Drawing.XGraphics.DrawRectangle C# (CSharp) Method

DrawRectangle() public method

Draws a rectangle.
public DrawRectangle ( XBrush brush, Rectangle rect ) : void
brush XBrush
rect Rectangle
return void
    public void DrawRectangle(XBrush brush, Rectangle rect)
    {
      DrawRectangle(brush, (double)rect.X, (double)rect.Y, (double)rect.Width, (double)rect.Height);
    }
#endif

Same methods

XGraphics::DrawRectangle ( XBrush brush, RectangleF rect ) : void
XGraphics::DrawRectangle ( XBrush brush, XRect rect ) : void
XGraphics::DrawRectangle ( XBrush brush, double x, double y, double width, double height ) : void
XGraphics::DrawRectangle ( XBrush brush, int x, int y, int width, int height ) : void
XGraphics::DrawRectangle ( XPen pen, Rectangle rect ) : void
XGraphics::DrawRectangle ( XPen pen, RectangleF rect ) : void
XGraphics::DrawRectangle ( XPen pen, XBrush brush, Rectangle rect ) : void
XGraphics::DrawRectangle ( XPen pen, XBrush brush, RectangleF rect ) : void
XGraphics::DrawRectangle ( XPen pen, XBrush brush, XRect rect ) : void
XGraphics::DrawRectangle ( XPen pen, XBrush brush, double x, double y, double width, double height ) : void
XGraphics::DrawRectangle ( XPen pen, XBrush brush, int x, int y, int width, int height ) : void
XGraphics::DrawRectangle ( XPen pen, XRect rect ) : void
XGraphics::DrawRectangle ( XPen pen, double x, double y, double width, double height ) : void
XGraphics::DrawRectangle ( XPen pen, int x, int y, int width, int height ) : void

Usage Example

Exemplo n.º 1
2
    void RenderTextAlignment(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XRect rect = new XRect(0, 0, 250, 140);

      XFont font = new XFont("Verdana", 10);
      XBrush brush = XBrushes.Purple;
      XStringFormat format = new XStringFormat();

      gfx.DrawRectangle(XPens.YellowGreen, rect);
      gfx.DrawLine(XPens.YellowGreen, rect.Width / 2, 0, rect.Width / 2, rect.Height);
      gfx.DrawLine(XPens.YellowGreen, 0, rect.Height / 2, rect.Width, rect.Height / 2);

#if true
      gfx.DrawString("TopLeft", font, brush, rect, format);

      format.Alignment = XStringAlignment.Center;
      gfx.DrawString("TopCenter", font, brush, rect, format);

      format.Alignment = XStringAlignment.Far;
      gfx.DrawString("TopRight", font, brush, rect, format);

      format.LineAlignment = XLineAlignment.Center;
      format.Alignment = XStringAlignment.Near;
      gfx.DrawString("CenterLeft", font, brush, rect, format);

      format.Alignment = XStringAlignment.Center;
      gfx.DrawString("Center", font, brush, rect, format);

      format.Alignment = XStringAlignment.Far;
      gfx.DrawString("CenterRight", font, brush, rect, format);

      format.LineAlignment = XLineAlignment.Far;
      format.Alignment = XStringAlignment.Near;
      gfx.DrawString("BottomLeft", font, brush, rect, format);

      format.Alignment = XStringAlignment.Center;
      gfx.DrawString("BottomCenter", font, brush, rect, format);

      format.Alignment = XStringAlignment.Far;
      gfx.DrawString("BottomRight", font, brush, rect, format);
#else
      format.Alignment = XStringAlignment.Far;
      gfx.DrawString("TopRight", font, brush, rect, format);
#endif
    }
All Usage Examples Of PdfSharp.Drawing.XGraphics::DrawRectangle