void CMyListView::InitializeListView()
{
/*
CListCtrl& m_list = GetListCtrl();//得到内置 listctrl 引用
LONG lStyle;
lStyle = GetWindowLong(m_list.m_hWnd, GWL_STYLE);//获得当前窗口风格
lStyle &= ~LVS_TYPEMASK; //清除显示方式
lStyle |= LVS_REPORT; //设置窗口风格
SetWindowLong(m_list.m_hWnd, GWL_STYLE, lStyle); //设置窗口风格
DWORD dwStyle = m_list.GetExtendedStyle();
//Ñ¡ÖÐijһÐÐʱʹÕûÐиßÁÁ(Ö»ÊÇÓÃÓÚ±¨±í·ç¸ñµÄ listctrl)
dwStyle |= LVS_EX_FULLROWSELECT;
dwStyle |= LVS_EX_GRIDLINES;//ÍøÂçÏß(Ö»ÊÊÓÃÓÚ±¨±í·ç¸ñlistctrl)
m_list.SetExtendedStyle(dwStyle); //设置扩展风格
m_list.SetBkColor(RGB(200, 200, 200)); //设置背景颜色
m_list.SetTextBkColor(RGB(200, 200, 200)); //设置文字背景颜色
m_list.SetTextColor(RGB(10, 10, 80)); //设置文字颜色
//插入标题
m_list.InsertColumn( 0, "Name", LVCFMT_CENTER, 80 );
m_list.InsertColumn( 1, "ID Number", LVCFMT_CENTER, 110 );
m_list.InsertColumn( 2, "Sex", LVCFMT_CENTER, 110 );
*/
CWaitCursor wc;
CListCtrl& theListCtrl = GetListCtrl();
theListCtrl.SetRedraw(FALSE);
//For the style LVS_EX_FULLROWSELECT, you'll need the following, depending on the OS:
//Windows NT: Requires version 5.0 or later (or version 4.0 with Internet Explorer 3.0 and later)..
//Windows: Requires Windows 98 (or Windows 95 with Internet Explorer 3.0 or later).
//Otherwise, you'll need to do ownerdrawn stuff. In that case, see the MFC ROWLIST sample.
DWORD dwExStyle = LVS_EX_FULLROWSELECT;
theListCtrl.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, (WPARAM)dwExStyle, (LPARAM)dwExStyle);
COLORREF crYellow = RGB(240,240,200); //light yellow
theListCtrl.SetBkColor(crYellow);
theListCtrl.SetTextBkColor(crYellow);
theListCtrl.InsertColumn(0, "name");
theListCtrl.InsertColumn(1, "address");
theListCtrl.InsertColumn(2, "city");
theListCtrl.InsertColumn(3, "state");
theListCtrl.InsertColumn(4, "zip code");
for(UINT i = 0; i< 5; i++)
theListCtrl.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);//根据行的字符串的宽度确定行的宽度
theListCtrl.SetRedraw(TRUE);
theListCtrl.Invalidate();
}