Question

I'm making a non-rectangular dialog, modelled over an image from Photoshop (the image is the background of the dialog, and the user will see trough the transparent part of the image). I'ts like a dashboard-style window for a media-app with a few custom-drawn controls. Most of the background-image is either opaque or 100% transparent - but in between there is a thin area of partially transparent pixels, ment to blend the image smootly into the background. This works great for web-graphics, but I have not found a way to make this work for Windows windows. I'm using the Windows Template Library (WTL), msvc 2008 - and the app must run on Windows XP as well as Vista and Windows 7.

Currently, I'm simply using the opaque part of the background-image to create a GDI clipping-region, but this gives pretty rough edges.

Does anyone know about any API functions to accomplish this (part of WTL, or reachable from WTL)?

Was it helpful?

Solution

Perhaps you could use layered windows? I haven't tested these with WTL but you should be able to get the effect you want. To the best of my knowledge I don't think you can add controls to a layered window so you'll need to attach it to another (non-layered) window to use controls.

OTHER TIPS

Not sure how this interoperates with WTL, but have a look at the AlphaBlend function. You'll need to select your partially transparent bitmap into a DC and copy that to your dialog's DC in your paint function.

This article shows how to use layered windows with WTL and the Gdi+ API which is available on all your target platforms.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top