MemoryDC drawIcon over masked bitmaps

Alessandro Crugnola wrote:

Hi,
I have this problem.
In a tree control I have to show items like a genericdirctrl, with the associated system icon.
Moreover if a file is under cvs or snv control I have to display the icon with the cvs o snv status (like TortoiseCVS does).

This is what I'm doing into a wxImageList instance:

bmp = wx.BitmapFromIcon(icon)
dc = wx.MemoryDC()
dc.SelectObject(bmp)
dc.DrawIcon(wx.Icon(icon_path, wx.BITMAP_TYPE_ICO, 16, 16), 0, 0)
icon_num = self.Add(bmp)

and everything works fine except for some kind of icons.
When there's an icon with a mask associated I can only display the cvs status icon, but not the background bitmap.

Does it make any difference if you also convert the second icon to a bitmap and do a DrawBitmap of it to the memorydc, adding the transparent=True parameter?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Alessandro Crugnola wrote:

Hi,
I have this problem.
In a tree control I have to show items like a genericdirctrl, with the associated system icon.
Moreover if a file is under cvs or snv control I have to display the icon with the cvs o snv status (like TortoiseCVS does).

This is what I'm doing into a wxImageList instance:

bmp = wx.BitmapFromIcon(icon)
dc = wx.MemoryDC()
dc.SelectObject(bmp)
dc.DrawIcon(wx.Icon(icon_path, wx.BITMAP_TYPE_ICO, 16, 16), 0, 0)
icon_num = self.Add(bmp)

and everything works fine except for some kind of icons.
When there's an icon with a mask associated I can only display the cvs status icon, but not the background bitmap.

Does it make any difference if you also convert the second icon to a bitmap and do a DrawBitmap of it to the memorydc, adding the transparent=True parameter?

but did you mean useMask parameter in the DrawBitmap function call?
because transparent is an invalid parameter:

nicon = wx.Icon(icon_path, wx.BITMAP_TYPE_ICO, 16, 16)
dc.DrawBitmap(wx.BitmapFromIcon(nicon), 0, 0, useMask=True)

btw, this doesnt make any difference

···

--
Alessandro Crugnola
Flash | PHP | Python Developer

+39 3939402645
+39 0236522445
--