Not able to use canvas function in Delphi 7

本秂侑毒 提交于 2020-01-17 03:55:07

问题


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.


回答1:


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;


来源:https://stackoverflow.com/questions/7147045/not-able-to-use-canvas-function-in-delphi-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!