Refresh和Repaint是一样的,它只是简单地调用了Repaint.
Update会导致整个窗口(对于没有窗口的TGraphicControl来说,就是它的父控件的窗口)立即处理WM_PAINT消息,即重画应该画的部分.
Invalidate使控件所在窗口的控件客户区域(对于TWinControl来说就是它的客户区域,对于TGraphicControl来说就是它的父控件的窗口在它的区域范围内的部分)失效,从而产生一个WM_PAINT消息,但并不马上重绘,直到其它消息处理完或遇到一个Update的调用.
Repaint是立即重绘该控件,在TWinControl中其实就是调用了Invalidate和Update,在TGraphiControl中分不同情况作了不同处理,逻辑稍复杂一些,但功能是一样的.

解决方案 »

  1.   

    from Mastering Delphi6,讲的很不错,不过是英文The Invalidate method informs Windows that the entire surface of the form should be repainted. The most important thing is that Invalidate does not enforce a painting operation immediately. Windows simply stores the request and will respond to it only
    after the current procedure has been completely executed and as soon as there are no other events pending in the system. Windows deliberately delays the painting operation because it is one of the most time-consuming operations. At times, with this delay,
    it is possible to paint the form only after multiple changes have taken place, avoiding multiple consecutive calls to the (slow) paint method.
    • The Update method asks Windows to update the contents of the form, repainting it
    immediately. However, remember that this operation will take place only if there is an invalid area. This happens if the Invalidate method has just been called or as the result
    of an operation by the user. If there is no invalid area, a call to Update has no effect at all. For this reason, it is common to see a call to Update just after a call to Invalidate.
    This is exactly what is done by the two Delphi methods, Repaint and Refresh.
    • The Repaint method calls Invalidate and Update in sequence. As a result, it activates the OnPaint event immediately. There is a slightly different version of this method called Refresh. For a form the effect is the same; for components it might be slightly different.When you need to ask the form for a repaint operation, you should generally call Invalidate,
    following the standard Windows approach. This is particularly important when you need to
    request this operation frequently, because if Windows takes too much time to update the
    screen, the requests for repainting can be accumulated into a simple repaint action. The
    wm_Paint message in Windows is a sort of low-priority message. To be more precise, if a
    request for repainting is pending but other messages are waiting, the other messages are handled before the system actually performs the paint action.
    On the other hand, if you call Repaint several times, the screen must be repainted each time before Windows can process other messages, and because paint operations are computationally intensive, this can actually make your application less responsive. There are times,
    however, when you want the application to repaint a surface as quickly as possible. In these less-frequent cases, calling Repaint is the way to go.Another important consideration is that during a paint operation Windows redraws only the
    so-called update region, to speed up the operation. For this reason if you invalidate only a
    portion of a window, only that area will be repainted. To accomplish this you can use the
    InvalidateRect and InvalidateRegion functions. Actually, this feature is a double-edged sword. It is a very powerful technique, which can improve speed and reduce the flickering caused by frequent repaint operations. On the other hand, it can also produce incorrect output.
    A typical problem is when only some of the areas affected by the user operations are actually modified, while others remain as they were even if the system executes the source code that is supposed to update them. In fact, if a painting operation falls outside the update region, the system ignores it, as if it were ou