From Xojo Documentation

Revision as of 23:55, 22 February 2022 by Gperlman (talk | contribs) (Notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!


New in 2020r2

Supported for all project types and targets.

Saves graphics state of the graphics context so that it can be restored later.


These values are saved with SaveState and are restored when you call RestoreState.

  • Translate
  • Clip region
  • PenSize
  • AntiAliased
  • DrawingColor
  • Font
  • Underline
  • Rotate (rotation)

Support for SaveState in Desktop and Console applications was added in 2021r1.

Sample Code

From within an MobileCanvas.Paint event handler:

g.DrawingColor = Color.Blue
g.FillRectangle(10, 10, 20, 20)

g.DrawingColor = Color.Red
g.FillRectangle(50, 50, 20, 20)

// Restore to state where FillColor is Blue
g.FillRectangle(10, 50, 20, 20)