Custom control with transparent parent

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
Post Reply
rajan_m
Knows some wx things
Knows some wx things
Posts: 39
Joined: Tue Jan 20, 2009 10:37 am
Location: chennai

Custom control with transparent parent

Post 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
Attachments
Test.zip
Test Source Code
(6.94 KiB) Downloaded 350 times
Transparent controls
Transparent controls
Last edited by rajan_m on Tue Jul 31, 2012 7:26 am, edited 1 time in total.
Every exit is an entry somewhere else!
Nelson Joseph
Experienced Solver
Experienced Solver
Posts: 65
Joined: Sun Oct 26, 2008 5:15 am
Location: Chennai, India
Contact:

Re: Transparent control with transparent bitmap

Post by Nelson Joseph »

Rajan sir,

Have you tried with wxTRANSPARENT_WINDOW|wxBORDER_NONE option in your class Transparent?
Regards,
Nelson Joseph
rajan_m
Knows some wx things
Knows some wx things
Posts: 39
Joined: Tue Jan 20, 2009 10:37 am
Location: chennai

Re: Transparent control with transparent bitmap

Post 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.
Every exit is an entry somewhere else!
Nelson Joseph
Experienced Solver
Experienced Solver
Posts: 65
Joined: Sun Oct 26, 2008 5:15 am
Location: Chennai, India
Contact:

Re: Custom control with transparent parent

Post 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.
Regards,
Nelson Joseph
Post Reply