我的程序中包含三个窗口,一个父窗口,一个TabControl子窗口还有一个ListView子窗口
我想在ListView中显示icon图标
具体操作为:
hImageListS=ImageList_Create(50,50,FALSE,3,0);
hImageListL=ImageList_Create(65,65,FALSE,3,0);
ImageList_AddIcon(hImageListS,hicon[0]);
ImageList_AddIcon(hImageListL,hicon[0]);
ListView_SetImageList(hwndList,LVSIL_SMALL,hImageListS);
ListView_SetImageList(hwndList,LVSIL_NORMAL,hImageListL);
…………………………………………
…………………………………………
for(iIndex=0;iIndex<5;iIndex++)
{
lvi.iItem=iIndex;
lvi.iImage=iIndex;
lvi.iSubItem=0;
lvi.pszText=LPSTR_TEXTCALLBACK;
ListView_InsertItem(hwndList,&lvi)
}
…………………………………………………………
要怎么改呀??? lvi.pszText=LPSTR_TEXTCALLBACK
}
我想在ListView中显示icon图标
具体操作为:
hImageListS=ImageList_Create(50,50,FALSE,3,0);
hImageListL=ImageList_Create(65,65,FALSE,3,0);
ImageList_AddIcon(hImageListS,hicon[0]);
ImageList_AddIcon(hImageListL,hicon[0]);
ListView_SetImageList(hwndList,LVSIL_SMALL,hImageListS);
ListView_SetImageList(hwndList,LVSIL_NORMAL,hImageListL);
…………………………………………
…………………………………………
for(iIndex=0;iIndex<5;iIndex++)
{
lvi.iItem=iIndex;
lvi.iImage=iIndex;
lvi.iSubItem=0;
lvi.pszText=LPSTR_TEXTCALLBACK;
ListView_InsertItem(hwndList,&lvi)
}
…………………………………………………………
要怎么改呀??? lvi.pszText=LPSTR_TEXTCALLBACK
}
每三个参数也要指定一下,下面的是可选的,
ILC_COLOR8
Use an 8-bit DIB section. The colors used for the color table are the same colors as the halftone palette.
ILC_COLOR16
Use a 16-bit (32/64k-color) DIB section.
ILC_COLOR24
Use a 24-bit DIB section.
ILC_COLOR32
Use a 32-bit DIB section.
如:ImageList_Create( 16, 16, ILC_COLOR32|ILC_MASK, 3, 3);
how large is your image list?
还是不能显示lvi.iImage is Index of the item's icon in the control's image list
我的hicon[w]数组是通过GetClassLongPtr(hwnd,GCLP_HICON)的到的,是不是不可以直接用ImageList_AddIcon(hImageListS,hicon[0])?