Home > Software engineering >  CListCtrl insert images show the order do not agree with the actual order
CListCtrl insert images show the order do not agree with the actual order

Time:10-11

As title, CListCtrl with CImageList binding, CListCtrl model as an icon, call insertItem () function inserts line to display images and text,

When inserting display images in the same function, insert the pictures can be displayed in accordance with the order of the insert,
But between different function to insert the image, insert images can only be at the end of the list, according to and the order of words and images in the list is correct,
Is the window shows the image list do not match the order list with the actual order,
Pray god to give directions how to let the window display image sequence consistent with the order of list actual ~

CodePudding user response:

CListCtrl you see if the control of the Sort attribute checked

CodePudding user response:

The sort of attribute value is none

CodePudding user response:

refer to the original poster mengzixing response:
such as topic, CListCtrl with CImageList binding, CListCtrl model as an icon, call the insertItem () function to insert row to display the images and text,

When inserting display images in the same function, insert the pictures can be displayed in accordance with the order of the insert,
But between different function to insert the image, insert images can only be at the end of the list, according to and the order of words and images in the list is correct,
Is the window shows the image list do not match the order list with the actual order,
Pray god to give directions how to let the window display image sequence consistent with the order of List actual ~
refresh the List also not...

CodePudding user response:

m_ListCtrl. Arrange (LVA_DEFAULT);
row it

CodePudding user response:

The
reference 4 floor zgl7903 reply:
m_ListCtrl. Arrange (LVA_DEFAULT);
row it
add after still won't do ah, inserted or in the pictures below show... Now every time a solution is to insert the new first to get rid of the original to insert again but the efficiency is very low...

CodePudding user response:

The code,

CodePudding user response:

refer to 6th floor zgl7903 response:
code,
m_ImageList. Add (pImage, RGB (0, 128, 128));
Int n=m_ImageList. GetImageCount () - 1;
PList - & gt; InsertItem (CurPosCount fileName_full, n);
for (int i=0; i {
Cstrings TmpFileName=pList - & gt; GetItemText (I, 0);
PList - & gt; The Update (I);
}
PList - & gt; To Arrange (LVA_ALIGNTOP);
PList - & gt; UpdateWindow ();

CodePudding user response:

refer to 7th floor mengzixing response:
Quote: refer to the sixth floor zgl7903 response:

Code,
m_ImageList. Add (pImage, RGB (0, 128, 128));
Int n=m_ImageList. GetImageCount () - 1;
PList - & gt; InsertItem (CurPosCount fileName_full, n);
for (int i=0; i {
Cstrings TmpFileName=pList - & gt; GetItemText (I, 0);
PList - & gt; The Update (I);
}
PList - & gt; To Arrange (LVA_ALIGNTOP);
PList - & gt; UpdateWindow ();
insert the picture into the CListCtrl code point is the pList CListCtrl m_ImageList CImageList is binding,
  • Related