Bitmap in List control
-
Hi, In my dialog bar i added one List control and added few colums and i add datas to that.In first colum i have to add image.But i cannot do that.Just i pasted the code..Pls see that and clear my problem. In Oncreate i added list control to dialog bar.
if (!m_RecentAlarms.oAlrmCombo.Create(LVS_REPORT|LVS_SHAREIMAGELISTS,rect,&m_RecentAlarms, ID_RECENTLIST))
{
TRACE0("Failed to create Listctrl\n");
return FALSE;
}m\_RecentAlarms.oAlrmCombo.InsertColumn(0, "", LVCFMT\_LEFT ,30); m\_RecentAlarms.oAlrmCombo.InsertColumn(1, "Date&Time", LVCFMT\_LEFT ,200); m\_RecentAlarms.oAlrmCombo.InsertColumn(2, "Location Tag", LVCFMT\_LEFT ,50); m\_RecentAlarms.oAlrmCombo.InsertColumn(3, "Location Item", LVCFMT\_LEFT ,50); m\_RecentAlarms.oAlrmCombo.InsertColumn(4, "Source", LVCFMT\_LEFT , 200); m\_RecentAlarms.oAlrmCombo.InsertColumn(5, "Condition", LVCFMT\_LEFT ,150); m\_RecentAlarms.oAlrmCombo.ShowWindow(SW\_SHOW);
And then i added the datas like this
POSITION pos = oSysAlarmList.FindIndex(fIndex);
while(pos)
{
....
... //Some coding,im getting data from CPtrList
...
CImageList m_SmallImg;
m_SmallImg.Create(IDB_ALARM_IMG, 16, 0, RGB(65, 65, 65));
m_rcntlist->SetImageList(&m_SmallImg, LVSIL_NORMAL);int nIndex = m\_rcntlist->InsertItem(0,"Alarm",0); m\_rcntlist->SetItemText(nIndex,1,objAlarm->tAlmdisTime.Format("%d/%m/%y %H:%M:%S")); m\_rcntlist->SetItemText(nIndex,2,""); m\_rcntlist->SetItemText(nIndex,3,""); m\_rcntlist->SetItemText(nIndex,4,pTag->GetTagName()); m\_rcntlist->SetItemText(nIndex,5,objAlarm->sStatus);
}
All texts are coming,only the images are not coming,I have three images in single bitmap ID file.Form that, depends on the alarm status i have to show images,if alarm is high i have to show red alarm.. Pls help me.
Anu
-
Hi, In my dialog bar i added one List control and added few colums and i add datas to that.In first colum i have to add image.But i cannot do that.Just i pasted the code..Pls see that and clear my problem. In Oncreate i added list control to dialog bar.
if (!m_RecentAlarms.oAlrmCombo.Create(LVS_REPORT|LVS_SHAREIMAGELISTS,rect,&m_RecentAlarms, ID_RECENTLIST))
{
TRACE0("Failed to create Listctrl\n");
return FALSE;
}m\_RecentAlarms.oAlrmCombo.InsertColumn(0, "", LVCFMT\_LEFT ,30); m\_RecentAlarms.oAlrmCombo.InsertColumn(1, "Date&Time", LVCFMT\_LEFT ,200); m\_RecentAlarms.oAlrmCombo.InsertColumn(2, "Location Tag", LVCFMT\_LEFT ,50); m\_RecentAlarms.oAlrmCombo.InsertColumn(3, "Location Item", LVCFMT\_LEFT ,50); m\_RecentAlarms.oAlrmCombo.InsertColumn(4, "Source", LVCFMT\_LEFT , 200); m\_RecentAlarms.oAlrmCombo.InsertColumn(5, "Condition", LVCFMT\_LEFT ,150); m\_RecentAlarms.oAlrmCombo.ShowWindow(SW\_SHOW);
And then i added the datas like this
POSITION pos = oSysAlarmList.FindIndex(fIndex);
while(pos)
{
....
... //Some coding,im getting data from CPtrList
...
CImageList m_SmallImg;
m_SmallImg.Create(IDB_ALARM_IMG, 16, 0, RGB(65, 65, 65));
m_rcntlist->SetImageList(&m_SmallImg, LVSIL_NORMAL);int nIndex = m\_rcntlist->InsertItem(0,"Alarm",0); m\_rcntlist->SetItemText(nIndex,1,objAlarm->tAlmdisTime.Format("%d/%m/%y %H:%M:%S")); m\_rcntlist->SetItemText(nIndex,2,""); m\_rcntlist->SetItemText(nIndex,3,""); m\_rcntlist->SetItemText(nIndex,4,pTag->GetTagName()); m\_rcntlist->SetItemText(nIndex,5,objAlarm->sStatus);
}
All texts are coming,only the images are not coming,I have three images in single bitmap ID file.Form that, depends on the alarm status i have to show images,if alarm is high i have to show red alarm.. Pls help me.
Anu
Anu_Bala wrote:
CImageList m_SmallImg; m_SmallImg.Create(IDB_ALARM_IMG, 16, 0, RGB(65, 65, 65));
Is
m_SmallImg
a member of the same class that the list control belongs to, or just some local variable? Have you tried playing around with different width/height values?Anu_Bala wrote:
All texts are coming,only the images are not coming...
Where is the code that adds images to the image list?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather