Главная страница | назад

Article #16235: Using InvalidateRect()to repaint the entire form

 Question and Answer Database

FAQ1235D.txt   Using InvalidateRect()to repaint the entire form
Category   :Windows API
Platform    :All
Product    :All 32 bit  

When I resize my form, the paint area is clipped, but I need to
repaint the whole area. The form's ClipRect is read only. 
How can I get around this?

During the resize event, make a call to the Windows API function
InvalidateRect(). Passing nil as the second parameter will cause
the clipping rect of the form to include the entire client area 
of the form. The third parameter denotes if the background of 
the form should be erased and repainted. Simply calling the 
invalidate method of the form may result in a clipping region 
and possibly the background getting erased.


procedure TForm1.FormResize(Sender: TObject);
  InvalidateRect(Form1.Handle, nil, false);

7/16/98 4:31:28 PM

Last Modified: 01-SEP-99