Window with Transparent holes
-
How do I create an irregular shaped window with transparent holes in the middle? I do not have an image and have to draw the window in the WM_PAINT event using GDI+. Any ideas would be welcome. Thanks.
--- :beer: Hakuna-Matata :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."
-
How do I create an irregular shaped window with transparent holes in the middle? I do not have an image and have to draw the window in the WM_PAINT event using GDI+. Any ideas would be welcome. Thanks.
--- :beer: Hakuna-Matata :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."
The only way I know is to use SetWindowRgn, and you will find several articles on CP about that (try looking in the dialog section). You can make the region any way you like (including processing a bitmap / making rectangles, etc) Its possible that you can do funky alpha transparency stuff in vista, but that's outside my experience. Iain.
-
How do I create an irregular shaped window with transparent holes in the middle? I do not have an image and have to draw the window in the WM_PAINT event using GDI+. Any ideas would be welcome. Thanks.
--- :beer: Hakuna-Matata :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."
For irregular shaped window see Simple way to create non-rectangular shaped dialogs [^] and for transparent window I saw an article on the codeproject but I dont remember its name now.
WhiteSky
-
For irregular shaped window see Simple way to create non-rectangular shaped dialogs [^] and for transparent window I saw an article on the codeproject but I dont remember its name now.
WhiteSky
Hi, Thanks for your reply. Well, I can always create an irregular shaped window using SetWindowRgn() but the problem with SetWindowRgn() is that the edges of the irregular window are not antialiased. I need to create a rounded rectangle window with the rounded part antialiased. Also, parts of the window need to be transparent like a circle in the middle of the window. Thanks...
--- :beer: Hakuna-Matata :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."
-
Hi, Thanks for your reply. Well, I can always create an irregular shaped window using SetWindowRgn() but the problem with SetWindowRgn() is that the edges of the irregular window are not antialiased. I need to create a rounded rectangle window with the rounded part antialiased. Also, parts of the window need to be transparent like a circle in the middle of the window. Thanks...
--- :beer: Hakuna-Matata :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."
Multiple windows? Could you create two semicircles and put them esde to edge to create the hole in the middle you are looking for? Peace!
-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
Hi, Thanks for your reply. Well, I can always create an irregular shaped window using SetWindowRgn() but the problem with SetWindowRgn() is that the edges of the irregular window are not antialiased. I need to create a rounded rectangle window with the rounded part antialiased. Also, parts of the window need to be transparent like a circle in the middle of the window. Thanks...
--- :beer: Hakuna-Matata :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."
Can't help with the antialiased thing, but I *think* theres some (eg)
SetWindowAlpha
function under vista I read about. (I did a search, and that's not the right name). Failing that, can't you make a region with a hole? Or did you try that and fail? You cna use CombineRng to merge regions to make them bigger, holes, etc... I don;t see anything in the docs for SetWindowRgn saying it has to be a solid region... Iain -
How do I create an irregular shaped window with transparent holes in the middle? I do not have an image and have to draw the window in the WM_PAINT event using GDI+. Any ideas would be welcome. Thanks.
--- :beer: Hakuna-Matata :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."
I knew it would hit me...
SetLayeredWindowAttributes
is the clue you need. For antialiasing, you can have one colour keyed to 0% alpha, another to 50% alpha, etc. Doing a quick search shows plenty of articles here on CP. And its a 2000 onward feature, not a vista one! Iain.