[Overview][Types][Classes][Index] | Reference for unit 'LazCanvas' (#lcl)

# TLazCanvas.SaveState

Saves the current canvas state in the GraphicStateList member.

## Declaration

Source position: lazcanvas.pas line 125

`public function TLazCanvas.SaveState: Integer;`

## Function result

Ordinal position in GraphicStateList where the saved canvas state was stored.

## Description

SaveState is an Integer function used to save the current canvas state in the GraphicStateList member. SaveState creates an instance of TLazCanvasState with copies of the current values for Brush, Pen, and Font. Values from BaseWindowOrg, WindowOrg, and Clipping are also assigned to the class instance.

The return value contains the ordinal position in GraphicStateList where the canvas state was added in the method.

Use RestoreState to restore the canvas to the state stored at a specified position in the list.

## See also

TLazCanvas.AssignedBrush |  | Brush assigned to the canvas.
TLazCanvas.AssignedPen |  | Pen assigned to the canvas.
TLazCanvas.AssignedFont |  | Font assigned to the canvas.
TLazCanvas.BaseWindowOrg |  | Base window origin for the canvas.
TLazCanvas.WindowOrg |  | Window origin for the canvas.
TLazCanvas.RestoreState |  | Restores the canvas to the state stored at the specified position.