PdfSharp.Drawing.XGraphics.Save C# (CSharp) Метод

Save() публичный Метод

Saves the current state of this XGraphics object and identifies the saved state with the returned XGraphicsState object.
public Save ( ) : XGraphicsState
Результат XGraphicsState
    public XGraphicsState Save()
    {
      XGraphicsState xState = null;
#if GDI
      if (this.targetContext == XGraphicTargetContext.GDI)
      {
        xState = new XGraphicsState(this.gfx.Save());
        InternalGraphicsState iState = new InternalGraphicsState(this, xState);
        iState.Transform = this.transform;
        this.gsStack.Push(iState);
      }
#endif
#if WPF
      if (this.targetContext == XGraphicTargetContext.WPF)
      {
        xState = new XGraphicsState();
        InternalGraphicsState iState = new InternalGraphicsState(this, xState);
        iState.Transform = this.transform;
        this.gsStack.Push(iState);
      }
#endif
      if (this.renderer != null)
        this.renderer.Save(xState);

      return xState;
    }

Usage Example

Пример #1
1
        /// <summary>
        /// Draws a sample box.
        /// </summary>
        public void BeginBox(XGraphics gfx, int number)
        {
            //obracene XY
            gfx.RotateAtTransform(90.0, new XPoint(height / 4, width / 4));
            gfx.TranslateTransform(+62, +63);
            //const int dEllipse = 15;
            XRect rect = new XRect(0, 0, height /2 -2, width/2 -2);

            if (number % 2 == 0)
                rect.X += height/2 +2;
            rect.Y =  ((number - 1) / 2) * (-width/2 - 3);
            //rect.Inflate(-10, -10);
            //XRect rect2 = rect;

            XPen pen = new XPen(XColors.Black, 1);

            gfx.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);

            //rect2.Offset(this.borderWidth, this.borderWidth);
            //gfx.DrawRoundedRectangle(new XSolidBrush(this.shadowColor), rect2, new XSize(dEllipse + 8, dEllipse + 8));
            //XLinearGradientBrush brush = new XLinearGradientBrush(rect, this.backColor, this.backColor2, XLinearGradientMode.Vertical);
            //gfx.DrawRoundedRectangle(this.borderPen, brush, rect, new XSize(dEllipse, dEllipse));
            //rect.Inflate(-5, -5);

            //rect.Inflate(-10, -5);
            //rect.Y += 20;
            //rect.Height -= 20;
            ////gfx.DrawRectangle(XPens.Red, rect);

            //    gfx.TranslateTransform(rect.X, rect.Y);

            this.state = gfx.Save();
        }
All Usage Examples Of PdfSharp.Drawing.XGraphics::Save