D
divers
Unregistered / Unconfirmed
GUEST, unregistred user!
我自定义一个控件,继承TImage,里面多了一个TTimer,我通过TTimer来控制canvas的刷新
Procedure TPool.OnTimer(Send:TObject);
Begin
self.invalidate;
End;
Procedure TPool.Draw;
Var i :Integer;
Begin
if fbFlooding then
Begin
with Canvas do
Begin
if di=s then di :=0 else di :=s;
i:=0;
while Height-di-i* 3*s>3*s do
Begin
inc(i);
Rectangle(5,di+(i-1)*3*s,11,di+(i-1)*3*s+2*s);
Rectangle(141,di+(i-1)*3*s,147,di+(i-1)*3*s+2*s);
Rectangle(20+di+(i-1)*3*s, 116,20+di+(i-1)*3*s+2*s, 122);
End;
End;
End;
End;
procedure TPool.Paint;
begin
Inherited Paint;
Draw;
end;
为什么ontimmer里面的invalidate的控制,对paint取不了作用,
paint的刷新速度不是Timer的Interval的间隔时间,??
Procedure TPool.OnTimer(Send:TObject);
Begin
self.invalidate;
End;
Procedure TPool.Draw;
Var i :Integer;
Begin
if fbFlooding then
Begin
with Canvas do
Begin
if di=s then di :=0 else di :=s;
i:=0;
while Height-di-i* 3*s>3*s do
Begin
inc(i);
Rectangle(5,di+(i-1)*3*s,11,di+(i-1)*3*s+2*s);
Rectangle(141,di+(i-1)*3*s,147,di+(i-1)*3*s+2*s);
Rectangle(20+di+(i-1)*3*s, 116,20+di+(i-1)*3*s+2*s, 122);
End;
End;
End;
End;
procedure TPool.Paint;
begin
Inherited Paint;
Draw;
end;
为什么ontimmer里面的invalidate的控制,对paint取不了作用,
paint的刷新速度不是Timer的Interval的间隔时间,??