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. Drawing a Bitmap Background

Drawing a Bitmap Background

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsquestion
8 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.
  • S Offline
    S Offline
    skjwtt
    wrote on last edited by
    #1

    I have a skinned dialog that I am attempting to place transparent buttons on; based on CButton. However, when I do a create I find that a blank space is created where my button should be. Therefore the background that shows through my transparent image is white rather than the skinned bitmap that should appear. I imagine that the reason this area is not painted is because that area is to be painted by the button. Is there a way to get that area of the background painted despite the fact that the button is to be painted there? Thanks in advance.

    M N S 3 Replies Last reply
    0
    • S skjwtt

      I have a skinned dialog that I am attempting to place transparent buttons on; based on CButton. However, when I do a create I find that a blank space is created where my button should be. Therefore the background that shows through my transparent image is white rather than the skinned bitmap that should appear. I imagine that the reason this area is not painted is because that area is to be painted by the button. Is there a way to get that area of the background painted despite the fact that the button is to be painted there? Thanks in advance.

      M Offline
      M Offline
      Mattias G
      wrote on last edited by
      #2

      (I assume that the buttons you are creating are subclassed CButton.) The white spaces is created by someone somewhere. Did you check your handling of WM_ERASEBKGND?

      S 1 Reply Last reply
      0
      • M Mattias G

        (I assume that the buttons you are creating are subclassed CButton.) The white spaces is created by someone somewhere. Did you check your handling of WM_ERASEBKGND?

        S Offline
        S Offline
        Shivanand Gupta
        wrote on last edited by
        #3

        wm_erase_backgroud should return TRUE; and show your background images in ONpaint method.

        S 1 Reply Last reply
        0
        • S skjwtt

          I have a skinned dialog that I am attempting to place transparent buttons on; based on CButton. However, when I do a create I find that a blank space is created where my button should be. Therefore the background that shows through my transparent image is white rather than the skinned bitmap that should appear. I imagine that the reason this area is not painted is because that area is to be painted by the button. Is there a way to get that area of the background painted despite the fact that the button is to be painted there? Thanks in advance.

          N Offline
          N Offline
          Niklas L
          wrote on last edited by
          #4

          Make sure you don't have WS_CLIPCHILDREN specified for your dialog window.

          home

          1 Reply Last reply
          0
          • S skjwtt

            I have a skinned dialog that I am attempting to place transparent buttons on; based on CButton. However, when I do a create I find that a blank space is created where my button should be. Therefore the background that shows through my transparent image is white rather than the skinned bitmap that should appear. I imagine that the reason this area is not painted is because that area is to be painted by the button. Is there a way to get that area of the background painted despite the fact that the button is to be painted there? Thanks in advance.

            S Offline
            S Offline
            skjwtt
            wrote on last edited by
            #5

            I apologize if my attempt to be succinct ended up being unclear. I have looked into what each of you have asked. @Mattias G: Yes, it is a subclassed CButton. I definitely agree that this is being created somewhere, it is just the where I am having difficulty with. I've looked at the OnEraseBkgnd and haven't found anything out of the norm. @shivanandgupta: My OnEraseBkgnd does return true. I do not handle Onpaint method in my dialog. @Niklas Lindquist I do not have WS_CLIPCHILDREN specified in my dialog window. I feel like this is actually rooted in how Create is handled by CButton, one of the window or button styles. I will write back if I find anything.

            S 1 Reply Last reply
            0
            • S Shivanand Gupta

              wm_erase_backgroud should return TRUE; and show your background images in ONpaint method.

              S Offline
              S Offline
              skjwtt
              wrote on last edited by
              #6

              I do handle OnPaint, it was a silly misstatement. I am not sure what you mean by "show your background images in OnPaint method"

              1 Reply Last reply
              0
              • S skjwtt

                I apologize if my attempt to be succinct ended up being unclear. I have looked into what each of you have asked. @Mattias G: Yes, it is a subclassed CButton. I definitely agree that this is being created somewhere, it is just the where I am having difficulty with. I've looked at the OnEraseBkgnd and haven't found anything out of the norm. @shivanandgupta: My OnEraseBkgnd does return true. I do not handle Onpaint method in my dialog. @Niklas Lindquist I do not have WS_CLIPCHILDREN specified in my dialog window. I feel like this is actually rooted in how Create is handled by CButton, one of the window or button styles. I will write back if I find anything.

                S Offline
                S Offline
                Shivanand Gupta
                wrote on last edited by
                #7

                Dear what do you want pls tell me details If you want customize button with some bitmap . and your dialog has background Bitmap. firstly you draw dialog bitmap in onpaint dialog. and derived class button should also call own onpaint method with button bitmap.

                S 1 Reply Last reply
                0
                • S Shivanand Gupta

                  Dear what do you want pls tell me details If you want customize button with some bitmap . and your dialog has background Bitmap. firstly you draw dialog bitmap in onpaint dialog. and derived class button should also call own onpaint method with button bitmap.

                  S Offline
                  S Offline
                  skjwtt
                  wrote on last edited by
                  #8

                  I've found and am trying to implement the suggestion found here (CButtonST v3.9) This basically states that I need to force each button to paint it's background after the OnEraseBkgnd is handled by the dialog by calling OnPostEraseBkgnd. Working on getting this solution to function correctly in my code.

                  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