而且要求显示第二个文件时却只显示第一个文件的另外一小部分?
CListView.cpp:
void CLView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_index=0; m_pImageList=new CImageList;
m_pImageList->Create (32,32,ILC_COLOR24 ,0,2);
GetListCtrl().SetImageList (m_pImageList,LVSIL_NORMAL );
}void CLView::OnFileOpen()
{
// TODO: Add your command handler code here
CListViewApp* app=(CListViewApp*)AfxGetApp();
CFileDialog dlg(TRUE);//TRUE为OPEN对话框,FALSE为SAVE AS对话框
if(dlg.DoModal()==IDOK)
{
app->g_filePathName[m_index]=dlg.GetPathName();
BITMAP* bitmap;
bitmap=new BITMAP;
CBitmap *pBitmap;
pBitmap=new CBitmap;
m_hBitmap[m_index]=(HBITMAP)LoadImage(NULL,app->g_filePathName[m_index],IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
pBitmap->Attach (m_hBitmap[m_index]);
m_pImageList->Add (pBitmap,RGB(255,255,255));
app->g_fileName[m_index]=dlg.GetFileName ();
GetListCtrl().InsertItem (m_index,app->g_fileName[m_index],m_index);
pBitmap->GetBitmap(bitmap);
m_x[m_index]=bitmap->bmWidth;
m_y[m_index]=bitmap->bmHeight;
m_index++;
}
}
CListView.cpp:
void CLView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_index=0; m_pImageList=new CImageList;
m_pImageList->Create (32,32,ILC_COLOR24 ,0,2);
GetListCtrl().SetImageList (m_pImageList,LVSIL_NORMAL );
}void CLView::OnFileOpen()
{
// TODO: Add your command handler code here
CListViewApp* app=(CListViewApp*)AfxGetApp();
CFileDialog dlg(TRUE);//TRUE为OPEN对话框,FALSE为SAVE AS对话框
if(dlg.DoModal()==IDOK)
{
app->g_filePathName[m_index]=dlg.GetPathName();
BITMAP* bitmap;
bitmap=new BITMAP;
CBitmap *pBitmap;
pBitmap=new CBitmap;
m_hBitmap[m_index]=(HBITMAP)LoadImage(NULL,app->g_filePathName[m_index],IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
pBitmap->Attach (m_hBitmap[m_index]);
m_pImageList->Add (pBitmap,RGB(255,255,255));
app->g_fileName[m_index]=dlg.GetFileName ();
GetListCtrl().InsertItem (m_index,app->g_fileName[m_index],m_index);
pBitmap->GetBitmap(bitmap);
m_x[m_index]=bitmap->bmWidth;
m_y[m_index]=bitmap->bmHeight;
m_index++;
}
}
An image list, represented by class CImageList, is a collection of same-sized images中所有图像大小都一致,没法单独设置大小