读书人

Tpaintbox控件的Refresh等三个步骤特点

发布时间: 2012-09-19 13:43:53 作者: rapoo

Tpaintbox控件的Refresh等三个方法特点、区别?
Tpaintbox控件下面三个方法各自在什么情况下使用,怎样使用:
Refresh ;
Repaint ;
Update ;



[解决办法]

Delphi(Pascal) code
procedure TControl.Update;begin  if Parent <> nil then Parent.Update;end;procedure TControl.Refresh;begin  Repaint;end;procedure TControl.Repaint;var  DC: HDC;begin  if (Visible or (csDesigning in ComponentState) and    not (csNoDesignVisible in ControlStyle)) and (Parent <> nil) and    Parent.HandleAllocated then    if csOpaque in ControlStyle then    begin      DC := GetDC(Parent.Handle);      try        IntersectClipRect(DC, Left, Top, Left + Width, Top + Height);        Parent.PaintControls(DC, Self);      finally        ReleaseDC(Parent.Handle, DC);      end;    end else    begin      Invalidate;      Update;    end;end; 

读书人网 >.NET

热点推荐