CWnd::SetRedraw
This page is specific to:.NET Framework Version:1.12.03.54.0
MFC Library Reference
CWnd::SetRedraw

An application calls SetRedraw to allow changes to be redrawn or to prevent changes from being redrawn.

void SetRedraw(
   BOOL bRedraw = TRUE 
);

Parameters

bRedraw
Specifies the state of the redraw flag. If this parameter is TRUE, the redraw flag is set; if FALSE, the flag is cleared.

Remarks

This member function sets or clears the redraw flag. While the redraw flag is cleared, the contents will not be updated after each change and will not be repainted until the redraw flag is set. For example, an application that needs to add several items to a list box can clear the redraw flag, add the items, and then set the redraw flag. Finally, the application can call the Invalidate or InvalidateRect member function to cause the list box to be repainted.

Example

// Updating a control or window with large amounts of data may cause 
// flicker. In such cases it may be better to turn off drawing

//...

   //m_list is a member of type CListCtrl
   m_List.SetRedraw(FALSE);  // turn drawing off regardless of list mode

//...
// Update control
//...

   m_List.SetRedraw(TRUE);  // turn drawing back on and update the window

   // invalidate the entire control, force painting
   m_List.Invalidate();
   m_List.UpdateWindow();

See Also

CWnd Overview | Class Members | Hierarchy Chart | WM_SETREDRAW

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View