Link to home
Start Free TrialLog in
Avatar of scooter1
scooter1

asked on

Transparent Dialog

How can i get what is behind my dialog box and paint it to the dialog box so that it appears transparent?
Avatar of RONSLOW
RONSLOW

You can set the WS_TRANSPARENT style odf the dialog.
oops should be WS_EX_TRANSPARENT extended style.

In the dialog resource editor there is a checkbox for this on the dialog properties.

in Win2000 there is a new WS_EX_LAYERED that does the job better .. look in the SDK docs.


look at the example in the VC MFC docs on ModifyStyleEX and the SDK docs on "CreateWindowEx" and "Layered Windows" and KB article Q92526
Avatar of scooter1

ASKER

Forgot to be more specific: I'm using VC++ 6.0 on an MFC dialog box based program and i don't want to set the style i want to paint whats behind it, on it. (if that's possible)
ASKER CERTIFIED SOLUTION
Avatar of RONSLOW
RONSLOW

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
um, this is a little over my head, thanks though
The way windows works, you need to create a device context for a bitmap, and then select the bitmap into the context so you can draw on in it, move it around etc.  And when creating a bitmap, you usually want it compatible with the display.

That is why the above looks so complicated -- there a lot of housekeeping.

Here is what it does (in summary)

1) makes sure you've actualyl given it a non-empty recatngle
2) get a DC for the display.  This is what we will be copying from
3) creates a DC to draw to the bitmap
4) ensure that the rectangle is within the screen rectangle
5) create the bitmap itself (compatible with the display)
6) select the bitmap into a device context so you can access it
7) copy from the screen to the bitmap
8) clean up afterwards

Anyway, the WS_EX_TRANSPARENT style should do what you want with no need to code anything.