unit painttest; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls; type TForm1 = class(TForm) PaintBox1: TPaintBox; procedure PaintBox1Paint(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private rbmp : TBitmap; { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.PaintBox1Paint(Sender: TObject); var i:integer; begin with PaintBox1 do begin Canvas.Pen.Color := clBlue; Canvas.MoveTo( 10, 10 ); Canvas.LineTo( 100, 100 ); Canvas.Brush.Color := clBtnFace; Canvas.Font.Name := 'Arial'; Canvas.TextOut( Canvas.PenPos.x, Canvas.PenPos.y,'This is the end of the line' ); Canvas.Draw(0,0,rbmp); for i:=10 to 20 do begin Canvas.Pixels[i,50] := clRed; end; end; end; procedure TForm1.FormCreate(Sender: TObject); begin rbmp:=TBitMap.Create; rbmp.LoadFromFile('hauto.bmp'); end; procedure TForm1.FormDestroy(Sender: TObject); begin rbmp.Free; end; end.