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 » Wed Jul 18, 2012 11:12 am

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 244 times
transparent.png
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 » Sun Jul 22, 2012 4:56 pm

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 » Mon Jul 23, 2012 5:13 am

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 » Thu Aug 02, 2012 1:00 pm

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