标签:
m_ListCtrl.SetExtendedStyle(m_ListCtrl.GetExtendedStyle()| LVS_EX_SUBITEMIMAGES | LVS_EX_GRIDLINES); m_ListCtrl.InsertColumn(0, L"#", LVCFMT_CENTER, 0); m_ListCtrl.InsertColumn(1,_T("T1"),LVCFMT_LEFT,100); m_ListCtrl.InsertColumn(2,_T("A1"),LVCFMT_LEFT,190); m_ListCtrl.InsertColumn(3,_T("A2"),LVCFMT_LEFT,190);
m_Imagelist.Create(150, 200,ILC_COLOR32|ILC_MASK, 8, 1); //----- 实例图象框; HBITMAP hBitmap; CBitmap *pBitmap; CString FilePathName = L"E:\\nn\\1.bmp"; //在资源的IDB_BITMAP1文件就是face.bmp导入的 pBitmap = new CBitmap; hBitmap=(HBITMAP)LoadImage(NULL,FilePathName, IMAGE_BITMAP,0,0,LR_LOADFROMFILE); pBitmap->Attach(hBitmap); m_Imagelist.Add(pBitmap, RGB(0,0,0)); m_ListCtrl.SetImageList(&m_Imagelist, LVSIL_SMALL); DWORD dw = m_Imagelist.GetImageCount(); CString str; for(int j = 0;j < 3 ;j ++){ m_ListCtrl.InsertItem(j,L"123",0); LVITEM item = {0}; item.iItem = j; item.iSubItem = 2; item.mask = LVIF_TEXT|LVIF_IMAGE; //item.iImage = 0; //图片索引值 item.pszText = _T("Virqin"); item.lParam = (LPARAM)m_hWnd; m_ListCtrl.SetItem(&item); } m_Imagelist.Detach();
标签:
原文地址:http://www.cnblogs.com/qq76211822/p/5148796.html