Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Window with Transparent holes

Window with Transparent holes

Scheduled Pinned Locked Moved C / C++ / MFC
questionoraclewinformsgraphicssecurity
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HakunaMatada
    wrote on last edited by
    #1

    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 H 3 Replies Last reply
    0
    • H HakunaMatada

      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 Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • H HakunaMatada

        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."

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        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


        H 1 Reply Last reply
        0
        • H Hamid Taebi

          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


          H Offline
          H Offline
          HakunaMatada
          wrote on last edited by
          #4

          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."

          J I 2 Replies Last reply
          0
          • H HakunaMatada

            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."

            J Offline
            J Offline
            James R Twine
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • H HakunaMatada

              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."

              I Offline
              I Offline
              Iain Clarke Warrior Programmer
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              • H HakunaMatada

                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 Offline
                I Offline
                Iain Clarke Warrior Programmer
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups