BCB & Transparent PNG´s

Hi !

I´m trying to display a partly transparent PNG File (Disk.png ) on my Desktop with Borland C++ Builder 6. To do so i use the TPNGImage 1.4 ( http://pngdelphi.sourceforge.net ) and setting the Form´s Transparency Color to clGreen and Transparency to true. What i get is this : http://home.arcor.de/flo99/desk.jpg . (The green Part is what should not be there) Any suggestions ? Thanks in advance !

------------------

Image linked. Keep in mind that biggest allowed inline image size is 500x375.

Pe8er

#254292

You are confusing transparent color windows with per-pixel alpha windows. In the first case, all pixels with a specific color are transparent, in the latter each pixel has an alpha channel of its own.

I'm no Borland expert so I can't tell you if you can do per pixel alpha with the TForm breed of classes...

#254331

No you can´t - if you use Alphablending it effects all Items on the Form including the Images. I was hopeing there was another way to display PNG Images without a visible form...

#254442

Well there's always the SDK way to go: It needs you to understand ::ModifyStyleEx(WS_EX_LAYERED,0); and the ::UpdateLayeredWindow() APIs. You'll need to give up WM_PAINT or OnPaint() based drawing style altogether, but then you're fine - you can even use a borderless TForm.

On a side note: Since this is borlandese coding, why not ask them 'Samurizers? They mastered transparent desktop PNGs with Delphi and can lend you a helping hand too.

hth,

herd

#254643

I have now tried to draw the PNG useing GDI+ but no matter what i do i get a white Background for the PNG file. Any suggestions ? Thanks !

#254771

You didn't understand:

You don't draw the window. You do UpdateLayeredWindow to let it get drawn by the system. Read the MSDN.

#255257