CyprUS
CyprUS

Reputation: 4239

Not able to use canvas function in Delphi 7

I am beginning to learn GDI graphics in Delphi 7. I am having problems in drawing Ellipses , Text etc. on my Main form. Basically I use this code:

     Form1.Canvas.TextOut(10,10,'sss');

Is this Canvas Property required to be associated with the Form? I haven't done any thing like that. Help will be appreciated.

Upvotes: 0

Views: 446

Answers (1)

jpfollenius
jpfollenius

Reputation: 16612

Make sure you put all painting code in the form's OnPaint event handler (documentation). This handler is called whenever the form needs to be repainted.

procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.TextOut(10,10,'sss');
end;

Upvotes: 3

Related Questions