Salut a tous,
J'ai overridé CListBox pour en personnaliser l'affichage. J'ajoute mes string grace a la fonction :
void CListBoxPerso::InsertItem(int nIndex, UINT nID, LPCTSTR lpszText)
{
int result=InsertString(nIndex,lpszText); //Inserts the string
if (result != LB_ERR || result != LB_ERRSPACE)
SetItemData(nIndex,nID); //Associates the ID with the index
}
le probleme est dans la fonction d'affichage drawitem, quand je fait un
GetText(lpDrawItemStruct->itemID, text); //Gets the item text
il y a n'importe quoi dans 'text' donc ca m'affiche n'importe quoi et c'est pas cool.
voici mon .h :
class CListBoxPerso : public CListBox
{
DECLARE_DYNAMIC(CListBoxPerso)
public:
CListBoxPerso();
virtual ~CListBoxPerso();
void InsertItem(int nIndex, UINT nID, LPCTSTR lpszText);
protected:
DECLARE_MESSAGE_MAP()
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) ;
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMIS);
};
Il faut juste que je resolve ce probleme sinon ca me bloque tout dans mon dev.
Merci a tous,Hart