Preventing Screen Flash During List Box Multiple UpdateLast reviewed: November 2, 1995Article ID: Q66479 |
The information in this article applies to:
SUMMARYThe 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.
MORE INFORMATIONThe 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 reference words: 3.00 3.10 3.50 3.51 4.00 95 flash flicker
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |