在帮助中的描述,请帮助翻译一下 :DescriptionUse OnPaint to perform special processing when the form is redrawn. Any special painting on the form should be done in this event. OnPaint occurs before any controls on the form are painted.Tip: To determine which portions of the form抯 canvas need to be repainted, use the ClipRect property of the canvas.If you use the form抯 Canvas property outside the OnPaint event, it will be erased and drawn-over by the next OnPaint event.
这段代码是什么意思? procedure TDemo3Form.FormCreate(Sender: TObject); begin Randomize; R := Random(100); end;procedure TDemo3Form.FormPaint(Sender: TObject);//关键是此代码起了什么作用了? begin Canvas.TextOut(0,0,'(1)输入圆半径R,求圆面积'); Canvas.TextOut(0,20,'(2)输入圆半径R,求圆内接正方形面积'); end;
一般默认为其标准的画法 当你需要额外的处理时 就需要在其中加一些代码 对自己的需求进行特殊处理 就是所谓的重画了。#9 就是TAB键的ASCII码
你看一下onPaint是响应了什么消息?应该是WM_PAINT
问题二:#9是什么意思?
TAB键的ASCII码
需要高手吗?我就能解决。
:DescriptionUse OnPaint to perform special processing when the form is redrawn. Any special painting on the form should be done in this event. OnPaint occurs before any controls on the form are painted.Tip: To determine which portions of the form抯 canvas need to be repainted, use the ClipRect property of the canvas.If you use the form抯 Canvas property outside the OnPaint event, it will be erased and drawn-over by the next OnPaint event.
procedure TDemo3Form.FormCreate(Sender: TObject);
begin
Randomize;
R := Random(100);
end;procedure TDemo3Form.FormPaint(Sender: TObject);//关键是此代码起了什么作用了?
begin
Canvas.TextOut(0,0,'(1)输入圆半径R,求圆面积');
Canvas.TextOut(0,20,'(2)输入圆半径R,求圆内接正方形面积');
end;
Canvas.TextOut(0,20,'(2)输入圆半径R,求圆内接正方形面积');
你運行一下不就知咯
在你的form的0,0位置出輸出"(1)输入圆半径R,求圆面积'"文字
在0,20位置輸出"(2)输入圆半径R,求圆内接正方形面积"文字