Listbox doesn't draw PNG transparency properly

Hi Listbox gurus - I’m working with a new listbox layout that draws the contents of cells in the CellBackgroundPaint and CellTextPaint events. I’ve gotten most elements sorted, except that PNG images with transparency are not being drawn properly. This is the gist of my code in the CellBackgroundPaint event:

g.ForeColor = &c3F9F3F00 g.FillRoundRect(1,1,g.width-2, g.height-2,8,8) g.DrawPicture(tapepic32,5,5)

The image tapepic32 is recognized as having a mask and both the image viewer in the IDE and Preview display it properly. However, when it is drawn in the cell, the transparent area is white.

This is being tested on Windows 8.1 and OS X 10.9.4 (Cocoa) with Xojo 12r2.

As an experiment, I forced the Transparent setting for the PNG to White and that seems to get things mostly sorted.

Hi Tim,

I’m interested in what you man by [quote]forced the Transparent setting for the PNG to White [/quote] . Is that something you do in a graphics package, or something you do in Xojo?

Jim

Try setting app.UseGdiPlus = True

Nice try - but that’s for Windows rather than Mac - no wonder I’d never heard of it.

Do it in Xojo. Find the graphic in the Navigator and in the Inspector set the Transparent property to White.

Be nice. We’re all just trying to help.

[quote=113694:@Tim Jones]Hi Listbox gurus - I’m working with a new listbox layout that draws the contents of cells in the CellBackgroundPaint and CellTextPaint events. I’ve gotten most elements sorted, except that PNG images with transparency are not being drawn properly. This is the gist of my code in the CellBackgroundPaint event:

g.ForeColor = &c3F9F3F00 g.FillRoundRect(1,1,g.width-2, g.height-2,8,8) g.DrawPicture(tapepic32,5,5)

The image tapepic32 is recognized as having a mask and both the image viewer in the IDE and Preview display it properly. However, when it is drawn in the cell, the transparent area is white.

This is being tested on Windows 8.1 and OS X 10.9.4 (Cocoa) with Xojo 12r2.[/quote]

Have you tried the code in a Canvas Paint event instead of the ListBox?