Поделиться через


CWnd::SetRedraw

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

void SetRedraw(
   BOOL bRedraw = TRUE 
);

Параметры

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

Заметки

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.

Пример

// 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();

Требования

Header: afxwin.h

См. также

Основные понятия

CWnd Class

CWnd Members

Hierarchy Chart

WM_SETREDRAW