TWinControl.GetDeviceContext function
Gets the device context for the control.
Declaration
function GetDeviceContext(var WindowHandle: HWND): HDC; overrideArguments
WindowHandle | Handle for the control represented in the device context. Updated in the method. |
Function result
Device context created for the control, or 0 when unavailable.
Description
GetDeviceContext is an overridden
HDC function in
TWinControl used to get the device context used for the control.
The device context provides a Handle (yes another one) with information about the drawing region on a display or printer. In the LCL, this essentially identifies a clipping rectangle for a given window handle. In TControl, the device context for the WindowHandle in the Parent control is used (because it does not have its own handle). In TWinControl, the Handle for the control is used.
GetDevice context calls the GetDC routine in the LCL interface to get a device context for the value in its Handle property. On successful completion of the routine, the return value is also assigned to the WindowHandle argument (which is the member for the WindowHandle property for display purposes).
An EOutOfResources exception is raised when GetDC returns an unassigned device context (0).
GetDeviceContext re-implements the inherited method.
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
