When you call the GdipSaveGraphics
function, an information block that holds the state of the Graphics
object is put on a stack. The GdipSaveGraphics
function returns a value that identifies that information block. When
you pass the identifying value to the GdipRestoreGraphics
function, the information block is removed from the stack and is used
to restore the Graphics object to the state it was
in at the time of the GdipSaveGraphics call. Note
that the identifier returned by a given call to the GdipSaveGraphics
function can be passed only once to the GdipRestoreGraphics
function.
Calls to the GdipSaveGraphics
function can be nested; that is, you can call the GdipSaveGraphics
function several times before you call the GdipRestoreGraphics function. Each time you call the GdipSaveGraphics function, an information block is put on the
stack, and you receive an identifier for the information block. When
you pass one of those identifiers to the GdipRestoreGraphics
function, the Graphics object is returned to the
state it was in at the time of the GdipSaveGraphics
call that returned that particular identifier. The information block
placed on the stack by that GdipSaveGraphics call
is removed from the stack, and all information blocks placed on that
stack after that GdipSaveGraphics call are also
removed.
Calls to the GdipBeginContainer
function place information blocks on the same stack as calls to the GdipSaveGraphics
function. Just as a GdipRestoreGraphics call is
paired with a GdipSaveGraphics call, an GdipEndContainer
call is paired with a GdipBeginContainer call.
Caution
When you call GdipRestoreGraphics, all information
blocks placed on the stack (by GdipSaveGraphics or
by GdipBeginContainer) after the corresponding call
to GdipSaveGraphics are removed from the stack.
Likewise, When you call GdipEndContainer, all
information blocks placed on the stack (by GdipSaveGraphics
or by GdipBeginContainer) after the corresponding
call to GdipBeginContainer are removed from the
stack.