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. how to draw transparent rectangle in MFC

how to draw transparent rectangle in MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
5 Posts 5 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.
  • S Offline
    S Offline
    saksp
    wrote on last edited by
    #1

    how to draw transparent rectangle in MFC I have tried using following code but it does not work. int nPrevMode = pDC->SetBkMode(TRANSPARENT); COLORREF bkcolor = pDC->SetBkColor(BLACK); pDC->Rectangle(rect1.left, rect1.top, rect1.right, rect1.bottom);

    thanks

    C S T M 4 Replies Last reply
    0
    • S saksp

      how to draw transparent rectangle in MFC I have tried using following code but it does not work. int nPrevMode = pDC->SetBkMode(TRANSPARENT); COLORREF bkcolor = pDC->SetBkColor(BLACK); pDC->Rectangle(rect1.left, rect1.top, rect1.right, rect1.bottom);

      thanks

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      Use CDC::FrameRect[^] or use CDC::Rectangle[^] with a NULL_BRUSH[^].

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

      1 Reply Last reply
      0
      • S saksp

        how to draw transparent rectangle in MFC I have tried using following code but it does not work. int nPrevMode = pDC->SetBkMode(TRANSPARENT); COLORREF bkcolor = pDC->SetBkColor(BLACK); pDC->Rectangle(rect1.left, rect1.top, rect1.right, rect1.bottom);

        thanks

        S Offline
        S Offline
        Stuart Dootson
        wrote on last edited by
        #3

        saksp wrote:

        does not work.

        Define what you expected to happen and what actually happened. I suspect your expectation doesn't match what the documentation promises. The documentation of SetBkMode says this:

        The background mix mode is used with text, hatched brushes, and pen styles that are not solid lines.

        Are you using any of those three?

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

        1 Reply Last reply
        0
        • S saksp

          how to draw transparent rectangle in MFC I have tried using following code but it does not work. int nPrevMode = pDC->SetBkMode(TRANSPARENT); COLORREF bkcolor = pDC->SetBkColor(BLACK); pDC->Rectangle(rect1.left, rect1.top, rect1.right, rect1.bottom);

          thanks

          T Offline
          T Offline
          tyr2000
          wrote on last edited by
          #4

          do you mean you need a frame not filled with any clour? if so,framerect may help you.

          1 Reply Last reply
          0
          • S saksp

            how to draw transparent rectangle in MFC I have tried using following code but it does not work. int nPrevMode = pDC->SetBkMode(TRANSPARENT); COLORREF bkcolor = pDC->SetBkColor(BLACK); pDC->Rectangle(rect1.left, rect1.top, rect1.right, rect1.bottom);

            thanks

            M Offline
            M Offline
            mohini1989
            wrote on last edited by
            #5

            good

            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