Switching Views


The list view control supports four different view styles.
The four styles are LVS_ICON , LVS_SMALLICON, LVS_LIST and LVS_REPORT.
To switch between views we have to modify the window style using GetWindowLong()
and SetWindowLong().

	// Switch to report view
	ModifyStyle( LVS_TYPEMASK, LVS_REPORT);

The LVS_TYPEMASK is a bit mask representing the bits for all the view styles.
Here is code for a SetView() member function for an extended list view
control class.

void CMyListCtrl::SetView(DWORD dwView)
{
	ModifyStyle( LVS_TYPEMASK, dwView & LVS_TYPEMASK );
}

More by Author

Must Read