Page 1 of 1

Custom control with transparent parent

Posted: Wed Jul 18, 2012 11:12 am
by rajan_m
Hi,

I'm having a custom control (with paint and erase background event ) on top of a transparent parent frame (moveable using mouse event) and i'm trying to draw a transparent png to the centre of the control without any luck.

What i'm getting is an image with black rectangle as background!. please see the attached screenshot which has two custom controls with centered image.

Is there any way we can draw png file with transparency?

Test Source code <Test.zip> attached.

Thanks in advance

Re: Transparent control with transparent bitmap

Posted: Sun Jul 22, 2012 4:56 pm
by Nelson Joseph
Rajan sir,

Have you tried with wxTRANSPARENT_WINDOW|wxBORDER_NONE option in your class Transparent?

Re: Transparent control with transparent bitmap

Posted: Mon Jul 23, 2012 5:13 am
by rajan_m
Nelson thanks for your reply. Yes i tried with wxTRANSPARENT_WINDOWand wxBORDER_NONE style for the transparent control but the problem is the background is not updated when we move the parent frame.

Re: Custom control with transparent parent

Posted: Thu Aug 02, 2012 1:00 pm
by Nelson Joseph
Sir,

Try to create a Shape class which is derived from wxObject and also use wxMemoryDC.
Also see the dragimag example code in wxWidgets' samples directory.