CImagelist CListView binding problem.

Category: VC/MFC -> Foundation Classes Author: lindaspring Date: 2001-08-20 18:26:27
 
lindaspring
2001-08-20 18:26:27
To the   displayed on the picture , so to bind a  ; listview & nbsp imagelist   object , but for   imagelist   object operation   would collapse ,
following is the code :
< . br /> h   file   li :
CImageList       m_ImageListThumb;

.cpp   initializing   view   li :

CListCtrl &   ListCtrl   =   GetListCtrl ();

// create   imagelist   object
m_ImageListThumb.Create (  THUMBNAIL_WIDTH,     // width
              HUMBNAIL_HEIGHT,     // length
              ILC_COLOR32,
              0,
              1  );

ListCtrl.SetImageList (  & m_ImageListThumb,   LVSIL_NORMAL  );

          within the operating functions :

.......
// pView   is   CListView   derived class pointer.

CListCtrl &   ListCtrl = pView- > GetListCtrl ();
CImageList *   pImgList = & pView- > m_ImageListThumb;

//   reset   our   image   list
for (int   i = 0;   i < pImgList- > GetImageCount ();   i ++)   // execution   GetImageCount   will collapse out . Right   pImgList   operations will collapse . . . {
        pImgList- > Remove (i);
}

//   remove   all   items   from   list   view
ListCtrl.DeleteAllItems ();
pImgList- > SetImageCount (m_useGdi.m_vFileName.size ());
................

what is wrong with it , get a day, under the guidance of my friends understand it .

qazfzz
2001-08-20 18:44:32
Where are you calling ? Is not no initialization is complete view ?
view is initialized to wait before they can call !
wavierwister
2001-08-20 18:55:54
CImageList *   pImgList = & pView- > m_ImageListThumb; much value is ah? Is not NULL ah?
sxdsly
2001-08-20 19:09:52
m_ImageListThumb.Create (  THUMBNAIL_WIDTH,   // width
HUMBNAIL_HEIGHT,   // length
ILC_COLOR32,
0,
1  ) ;
//
BOOL   Create (  int   cx,   int   cy,   UINT   nFlags,   int   nInitial,   int   nGrow  );
//
int   nInitial = 0 ???
woshi9264
2001-08-20 19:15:15


pImageList   is   0x0012f5cc (COject)     not NULL
MissHQY
2001-08-20 19:22:27

No, the program generated after all , I am a button called, certainly initialize play.
nisisei
2001-08-20 19:36:04
then you look at the members of this object inside of it , is not all OK, I guess that was not initialized.
Hank89
2001-08-20 19:38:33
m_ImageListThumb.Create, what the return value is ? Success yet?
xu375465229
2001-08-20 19:57:14

I was based on the dialog created   CListView   derived class  , no DOC   class ,   it does not automatically call the   OnInitialUpdate   I still own the dialog inside this initialization call it, this is not right
zhugongxing
2001-08-20 20:05:02
does not work, use gridctrl
can easily be used in the dialog box , there is source code !
ggd543_1
2001-08-20 20:10:58
your case , gridctrl there are ready-made demo can learn
wanghui1024
2001-08-20 20:25:23

I looked at the return value is TRUE   ah