var
Form1: TForm1;
cnv: TCanvas;
hnd: HWND;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
cnv := TCanvas.create;
hnd := GetWindowDC(0);
cnv.handle := hnd;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
cnv.free;
releasedc(0, hnd);
end;
// Ausgabe einer diagonalen Linie
procedure TForm1.Button1Click(Sender: TObject);
begin
cnv.pen.color := clblue;
cnv.pen.width := 5;
cnv.moveto(0, 0);
cnv.lineto(screen.width, screen.height);
end;
// Ausgabe eines Textes
procedure TForm1.Button2Click(Sender: TObject);
begin
cnv.font.name := 'Arial';
cnv.font.size := 50;
cnv.font.color := clred;
cnv.brush.style := bsclear;
cnv.textout(100, 100, 'Das ist ein Test');
end;
// Ausgabe eines Bildes
procedure TForm1.Button3Click(Sender: TObject);
var bm: TBitmap;
begin
bm := TBitmap.create;
bm.loadfromfile('c:\bilder\test.bmp');
cnv.draw(50, 50, bm);
bm.free;
end;