Sign in Join
FPDoc Onlineexperiment

TCanvas.Handle property

Member of TCanvaspublicIn unit Graphics

Handle (or device context) for the drawing surface.

Declaration

pascal
property Handle: HDC read GetHandle write SetHandle;

Description

Handle is a HDC property that provides the device context for the drawing surface. A valid Handle is required for nearly all operations performed on the canvas.

Read access calls RequiredState, and allocates a Handle by calling CreateHandle if one does not already exist. An EInvalidGraphicOperation exception may be raised in the method if a valid handle cannot be acquired.

CreateHandle is an empty implementation in TCanvas, and is overridden in descendent classes to return a handle for an image format or output device. See TBitmapCanvas, TControlCanvas, TPrinterCanvas, et. al.

Setting a new value for Handle causes saved Brush, Pen, and Font handles to be reset to their default values. The AntialiasingMode for the canvas is also re-applied.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.