Vcl.Controls.TWinControl.PaintTo

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure PaintTo(DC: HDC; X, Y: Integer); overload;
procedure PaintTo(Canvas: TCanvas; X, Y: Integer); overload;

C++

void __fastcall PaintTo(HDC DC, int X, int Y)/* overload */;
void __fastcall PaintTo(Vcl::Graphics::TCanvas* Canvas, int X, int Y)/* overload */;

Properties

Type Visibility Source Unit Parent
procedure
function
public
Vcl.Controls.pas
Vcl.Controls.hpp
Vcl.Controls TWinControl

Description

Draws the windowed control to a device context.

Call PaintTo to draw the control on a device context. Specify the device context as the value of the DC parameter and specify the X and Y coordinates on the device context where the top-left corner of the windowed control is to be drawn. PaintTo first erases the background of the device context and then paints the control.

PaintTo is useful for drawing an image of the control into a bitmap DC.

Warning: When using PaintTo to draw on a canvas, you must lock the canvas first (and unlock it after the call to PaintTo. If you do not lock the canvas, Windows calls that occur while the control is painting can cause the canvas to lose its handle.

See Also

Code Examples