![]() |
ImageManager issue in 11.2.1 |
Post Reply
|
| Author | |
pavold
Newbie
Joined: 14 May 2007 Status: Offline Points: 23 |
Post Options
Thanks(0)
Quote Reply
Topic: ImageManager issue in 11.2.1Posted: 03 December 2007 at 8:27am |
|
Hi,
After upgrading to toolkitpro 11.2.1, I have encountered a problem. We are using CXTPImageManager to load icons for a treeview control. Here is the code: CImageList m_ImageList; m_ImageList.Create(16, 16, ILC_MASK | ILC_COLOR32, 0, 0); <...> CXTPImageManagerIconSet*pIconSet=XTPImageManager()->GetIconSet(nIcon); if(pIconSet==0) { return false; } CXTPImageManagerIcon* pIcon=pIconSet->GetIcon(16); if(pIcon==0) { return false; } m_ImageList.Add(CBitmap::FromHandle(pIcon->GetIcon().GetBitmap()), (CBitmap*)0); The actual images are loaded to the image manager from a 32-bit png-file. This worked fine with the version 11.1.3 . Now I cannot see any icons in the treeview. Debugging showed that I get valid (not null) iconset and an icon. Event GetIcon().GetBitmap() seems to return a valid handle. I've seen that the release notes mention some ImageManager changes, but I was not able to figure out what to do. Best Regards, Pavol |
|
![]() |
|
pavold
Newbie
Joined: 14 May 2007 Status: Offline Points: 23 |
Post Options
Thanks(0)
Quote Reply
Posted: 03 December 2007 at 8:32am |
|
Sorry for the misinformation. I have just found out that GetBitmap() returns 0.
How can I get a valid handle? |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 03 December 2007 at 3:21pm |
|
Hello,
See release notes - we modified imagemanager. You can create copy of handle before access:
handle.CopyHandle(pIcon->GetIcon());
m_ImageList.Add(CBitmap::FromHandle(handle.GetBitmap()), (CBitmap*)0);
But think you can better use direct methods that load alpha bitmaps.
btw - CImageList supports 32bit alpha bitmaps only in WindowsXP, but CXTPImageManager for all OS.....
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
iamthewind
Newbie
Joined: 11 September 2007 Location: China Status: Offline Points: 22 |
Post Options
Thanks(0)
Quote Reply
Posted: 16 December 2007 at 10:36pm |
|
oleg, I have a question on this topic too.
I wish to using CXTPImageManager to load icons for a CXTTreeCtrl control,
but CXTTreeCtrl only support CImageList:
CImageList* SetImageList(CImageList* pImageList, int nImageListType);
you said "CImageList supports 32bit alpha bitmaps only in WindowsXP, but CXTPImageManager for all OS.....",
but how could I use CXTPImageManager for CXTTreeCtrl?
Thanks very much!
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 17 December 2007 at 1:25am |
|
Yes, CXTTreeCtrl doesn't support ImageManager :(
You can manually draw icons in OnCustomDraw handler:
void CTreeViewCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult) { NMTVCUSTOMDRAW* lpLVCD = reinterpret_cast<NMTVCUSTOMDRAW*>(pNMHDR);
*pResult = CDRF_DODEFAULT; switch (lpLVCD->nmcd.dwDrawStage)
{ case CDDS_PREPAINT: *pResult = CDRF_NOTIFYITEMDRAW; break; case CDDS_PREPAINT | CDDS_ITEM:
{ *pResult |= CDRF_NOTIFYPOSTPAINT; break; } case CDDS_POSTPAINT | CDDS_ITEM:
case CDDS_POSTPAINT | CDDS_ITEM | CDDS_SUBITEM: { ...
CXTPImageManagerIcon* pIcon = m_pIcons->GetImage(pItem->m_nIcon, m_nIconSize); if (!pIcon) pIcon = m_pIcons->GetImage(pItem->m_nIcon, ICON_SMALL); if (!pIcon) return; CRect rc(0, 0, 0, 0);
GetTreeCtrl()->GetItemRect(pItem->m_hItem, rc, TRUE); if (!rc.IsRectEmpty()) { XTPImageState imageState = xtpImageNormal; if (GetTreeCtrl()->GetItemState(hItem, TVIS_SELECTED) & TVIS_SELECTED) imageState = xtpImageHot; CPoint pt(rc.left - m_nIconSize - 2, (rc.top + rc.bottom - sz.cy) / 2);
pIcon->Draw(CDC::FromHandle(lpLVCD->nmcd.hdc), pt, pIcon->GetIcon(imageState), sz); } ... break;
} } |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |