[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Controls' (#lcl)

# TControlCanvas.FreeHandle

Frees the Handle for the control canvas, and its device context when assigned.

## Declaration

Source position: controls.pp line 368

`public procedure TControlCanvas.FreeHandle; override;`

## Description

FreeHandle is an overridden method in TControlCanvas. It calls the inherited method on entry to set the value in Handle to 0 (the unassigned value). If a device context (DC) has been allocated for the window handle (HWND), the ReleaseDC routine is called to release the device context.

FreeHandle is called when a new value is assigned to the Control property, or when the class instance is freed.

## See also

TControlCanvas.Destroy |  | Destructor for the class instance.
TControlCanvas.Control |  | The Control object for which the Canvas is used.
TCanvas.Handle |  | Handle (or device context) for the drawing surface.
TCanvas.FreeHandle |  | Frees the Handle for the canvas.
ReleaseDC |  | Releases an Device Context obtained by GetDC.