HOWTO: Prevent Screen Flash During List Box Multiple UpdateID: Q66479
|
The WM_SETREDRAW message can be used to set and clear the redraw flag for a window. Before an application adds many items to a list box, this message can be used to turn the redraw flag off, which prevents the list box from being painted after each addition. Properly using the WM_SETREDRAW message keeps the list box from flashing after each addition.
The following four steps outline ways to use the WM_SETREDRAW message to
facilitate making a number of changes to the contents of a list box in a
visually pleasing manner:
/* Step 1: Clear the redraw flag. */
SendMessage(hWndList, WM_SETREDRAW, FALSE, 0L);
/* Step 2: Add the strings. */
for (i = 0; i < n; i++)
SendMessage(hWndList, LB_ADDSTRING, ...);
/* Step 3: Set the redraw flag. */
SendMessage(hWndList, WM_SETREDRAW, TRUE, 0L);
/* Step 4: Invalidate the list box window to force repaint. */
InvalidateRect(hWndList, NULL, TRUE);
Additional query words: flash flicker win16sdk
Keywords : kbCtrl kbListBox kbNTOS kbGrpUser kbWinOS
Version :
Platform :
Issue type : kbhowto
Last Reviewed: March 5, 1999