Sometimes we are in the process of operation of the window, the window will be refreshed lead flashing, in order to prevent flashing of the window, we add some statements before and after each operation, can prevent the window flashing.
SendMessage (Application.MainForm.Handle, WM_SETREDRAW, 0,0); // disable updating window
Own code
SendMessage (Application.MainForm.Handle, WM_SETREDRAW, 1,0) ; // can update window
ReDrawWindow (Application.MainForm.Handle, nil, 0, RDW_INVALIDATE or RDW_ALLCHILDREN or RDW_FRAME); // refresh the window