CImageList and a CListCtrl
-
i am in need of how to add the checkbox image to the header of a CListCtrl i have a child dialog in the main dialog ive looked in msdn but im lost
CImageList * imagelist; CHeaderCtrl * m_pHdrCtrl; imagelist = new CImageList(); ASSERT(imagelist != NULL); imagelist->Create(13, 13, ILC_COLOR24, 3, 1); CBitmap bm; bm.LoadBitmap(IDB_CHECKBOXES); imagelist->Add(&bm, RGB(255, 0, 255)); m_pHdrCtrl->SetImageList(imagelist);
that gives no errors on compiling it m_pHdrCtrl->SetImageList(imagelist); <-- wont allow me to build the exe im a beginner be gentle when telling me how wrong it is :sigh: i cant figure out how to add the imagelist to the header. -
i am in need of how to add the checkbox image to the header of a CListCtrl i have a child dialog in the main dialog ive looked in msdn but im lost
CImageList * imagelist; CHeaderCtrl * m_pHdrCtrl; imagelist = new CImageList(); ASSERT(imagelist != NULL); imagelist->Create(13, 13, ILC_COLOR24, 3, 1); CBitmap bm; bm.LoadBitmap(IDB_CHECKBOXES); imagelist->Add(&bm, RGB(255, 0, 255)); m_pHdrCtrl->SetImageList(imagelist);
that gives no errors on compiling it m_pHdrCtrl->SetImageList(imagelist); <-- wont allow me to build the exe im a beginner be gentle when telling me how wrong it is :sigh: i cant figure out how to add the imagelist to the header.locoone wrote:
m_pHdrCtrl->SetImageList(imagelist); <-- wont allow me to build the exe
What do you mean? After puttin the above statement your not getting the output exe?
nave [OpenedFileFinder]
-
i am in need of how to add the checkbox image to the header of a CListCtrl i have a child dialog in the main dialog ive looked in msdn but im lost
CImageList * imagelist; CHeaderCtrl * m_pHdrCtrl; imagelist = new CImageList(); ASSERT(imagelist != NULL); imagelist->Create(13, 13, ILC_COLOR24, 3, 1); CBitmap bm; bm.LoadBitmap(IDB_CHECKBOXES); imagelist->Add(&bm, RGB(255, 0, 255)); m_pHdrCtrl->SetImageList(imagelist);
that gives no errors on compiling it m_pHdrCtrl->SetImageList(imagelist); <-- wont allow me to build the exe im a beginner be gentle when telling me how wrong it is :sigh: i cant figure out how to add the imagelist to the header. -
i am in need of how to add the checkbox image to the header of a CListCtrl i have a child dialog in the main dialog ive looked in msdn but im lost
CImageList * imagelist; CHeaderCtrl * m_pHdrCtrl; imagelist = new CImageList(); ASSERT(imagelist != NULL); imagelist->Create(13, 13, ILC_COLOR24, 3, 1); CBitmap bm; bm.LoadBitmap(IDB_CHECKBOXES); imagelist->Add(&bm, RGB(255, 0, 255)); m_pHdrCtrl->SetImageList(imagelist);
that gives no errors on compiling it m_pHdrCtrl->SetImageList(imagelist); <-- wont allow me to build the exe im a beginner be gentle when telling me how wrong it is :sigh: i cant figure out how to add the imagelist to the header.Hi, if this is the code you wrote it cannot work. You declared a pointer to
CHeaderCtrl
and some lines below you access this pointer which you never set. This code compiles fine but certainly it results in a crash! You have to ask yourCListCtrl
instance for the pointer to its header control... Try the following:CHeaderCtrl* m_pHdrCtrl = m_YourListCtrl.GetHeaderCtrl();
if(m_pHdrCtrl != NULL)
{
CImageList * imagelist;
imagelist = new CImageList();
ASSERT(imagelist != NULL);
imagelist->Create(13, 13, ILC_COLOR24, 3, 1);
CBitmap bm;
bm.LoadBitmap(IDB_CHECKBOXES);
imagelist->Add(&bm, RGB(255, 0, 255));
m_pHdrCtrl->SetImageList(imagelist);
}cheers, mykel
OMM: "Let us be thankful we have an occupation to fill. Work hard, increase production, prevent accidents and be happy."
-
locoone wrote:
m_pHdrCtrl->SetImageList(imagelist); <-- wont allow me to build the exe
What do you mean? After puttin the above statement your not getting the output exe?
nave [OpenedFileFinder]
-
now only i noticed you are not assigning any thing in to the CHeaderCtrl * m_pHdrCtrl; you must call the GetHeaderCtrl() function and set that pointer to the m_pHdrCtrl. like CHeaderCtrl * m_pHdrCtrl = m_ListCTrl.GetHeaderCtrl();
nave [OpenedFileFinder]