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. Displaying 2 BMPs at the same position

Displaying 2 BMPs at the same position

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++
6 Posts 2 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.
  • G Offline
    G Offline
    GUEJO
    wrote on last edited by
    #1

    Hello I'm kinda newbie in C++ and I'd like to display 2 bitmaps at the same position, or clearlier, one above another. I loaded the bitmaps in the resources (I'm using VC++ 6.0) and I then had their IDs.:( I added a picture control and used the classwizard to get a CStatic variable associated to the picture control (it's actually a CStatic one):| Now I try to display these bitmaps in function of the resolution so I must use SetWindowPos to set properly the size, the position and the Z-order (the depth). The problem comes from the fact that however I try, it's always the wrong BMP that is over the other, hiding it.:confused: If anyone could help me, it would be very nice :rose:

    P 1 Reply Last reply
    0
    • G GUEJO

      Hello I'm kinda newbie in C++ and I'd like to display 2 bitmaps at the same position, or clearlier, one above another. I loaded the bitmaps in the resources (I'm using VC++ 6.0) and I then had their IDs.:( I added a picture control and used the classwizard to get a CStatic variable associated to the picture control (it's actually a CStatic one):| Now I try to display these bitmaps in function of the resolution so I must use SetWindowPos to set properly the size, the position and the Z-order (the depth). The problem comes from the fact that however I try, it's always the wrong BMP that is over the other, hiding it.:confused: If anyone could help me, it would be very nice :rose:

      P Offline
      P Offline
      Paul M Watt
      wrote on last edited by
      #2

      Are you sure that you are using SetWindowPos properly to set the ZOrder of your static controls?


      Build a man a fire, and he will be warm for a day
      Light a man on fire, and he will be warm for the rest of his life!

      G 1 Reply Last reply
      0
      • P Paul M Watt

        Are you sure that you are using SetWindowPos properly to set the ZOrder of your static controls?


        Build a man a fire, and he will be warm for a day
        Light a man on fire, and he will be warm for the rest of his life!

        G Offline
        G Offline
        GUEJO
        wrote on last edited by
        #3

        Actually I've done a lot of combinations : first.SetWindowPos(&wndTop,...); second.SetWindowPos(&wndTop,...); or with the SWP_NOZORDER flagat the end I also tried to initialise in a different way which is first set the second then the first and it was the same result. I finally tried to change the tab order and it worked !!! But what I'm trying is to do the same with the CxSkinButton furnished here, on this site and it does not work as well as I wanted (By the way it is a great code) sorry I do not have time to explain more in details, I will continue tomorrow... .:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:..:.:.:.:.:.:.:.:..:.:. Should computing stay as a source of benefit or become like knowledge : free and opened to every one ?... ;)

        P 2 Replies Last reply
        0
        • G GUEJO

          Actually I've done a lot of combinations : first.SetWindowPos(&wndTop,...); second.SetWindowPos(&wndTop,...); or with the SWP_NOZORDER flagat the end I also tried to initialise in a different way which is first set the second then the first and it was the same result. I finally tried to change the tab order and it worked !!! But what I'm trying is to do the same with the CxSkinButton furnished here, on this site and it does not work as well as I wanted (By the way it is a great code) sorry I do not have time to explain more in details, I will continue tomorrow... .:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:..:.:.:.:.:.:.:.:..:.:. Should computing stay as a source of benefit or become like knowledge : free and opened to every one ?... ;)

          P Offline
          P Offline
          Paul M Watt
          wrote on last edited by
          #4

          I am not usre what wndTop is in your example, but what you would do is call SetWindowPos on the static control that you want to be placed on top, and you would place the handle of the bottom control in the hwndAFter parameter of the function. You will only need to call this function once to set the order that you are interested in.


          Build a man a fire, and he will be warm for a day
          Light a man on fire, and he will be warm for the rest of his life!

          G 1 Reply Last reply
          0
          • G GUEJO

            Actually I've done a lot of combinations : first.SetWindowPos(&wndTop,...); second.SetWindowPos(&wndTop,...); or with the SWP_NOZORDER flagat the end I also tried to initialise in a different way which is first set the second then the first and it was the same result. I finally tried to change the tab order and it worked !!! But what I'm trying is to do the same with the CxSkinButton furnished here, on this site and it does not work as well as I wanted (By the way it is a great code) sorry I do not have time to explain more in details, I will continue tomorrow... .:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:..:.:.:.:.:.:.:.:..:.:. Should computing stay as a source of benefit or become like knowledge : free and opened to every one ?... ;)

            P Offline
            P Offline
            Paul M Watt
            wrote on last edited by
            #5

            BTW, TAb order and Z-order are the same thing. Tab order is just how it is referred to in the dialog editor.


            Build a man a fire, and he will be warm for a day
            Light a man on fire, and he will be warm for the rest of his life!

            1 Reply Last reply
            0
            • P Paul M Watt

              I am not usre what wndTop is in your example, but what you would do is call SetWindowPos on the static control that you want to be placed on top, and you would place the handle of the bottom control in the hwndAFter parameter of the function. You will only need to call this function once to set the order that you are interested in.


              Build a man a fire, and he will be warm for a day
              Light a man on fire, and he will be warm for the rest of his life!

              G Offline
              G Offline
              GUEJO
              wrote on last edited by
              #6

              Here a little quotation of MSDN doc about CWnd::SetWindowPos, the function I'm using (here you've got the description of the first parameter) pWndInsertAfter    Identifies the CWnd object that will precede this CWnd object in the Z-order. This parameter can be a pointer to a CWnd or a Pointer to one of the following values:

              • wndBottom   Places the window at the bottom of the Z-order. If this CWnd is a topmost window, the window loses its topmost status; the system places the window at the bottom of all other windows.

              • wndTop   Places the window at the top of the Z-order.

              • wndTopMost   Places the window above all nontopmost windows. The window maintains its topmost position even when it is deactivated.

              • wndNoTopMost   Repositions the window to the top of all nontopmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a nontopmost window.

              As you can see I'm actually using the predefined variable. I tried with other variable such as the Picture controls that should be under others : It works well (for example I used : upper.SetWindowPos(lower,...) where upper and lower are 2 Picture controls). But what is wrong is when I use this class : CxSkinButton. This class is a marvelous Button which can have any shape and any bitmap over. It reacts to the mouse over event and change bitmap when it occurs. So what's interesting here, is that the buttons are hidden behind a bitmap that should normally be shown behind them at the beginning. And when I go over where they should appear with the mouse, then they appear with the 'MouseOver' bitmap. After I leave the sensitive zone, the button remains visible with proper bitmap and is working as it should work. So, actually my problem is that when I start the application, I must move the mouse over each button so that it can appear => :(( I hope I've explain not so bad because it's a bit confusing... Thank you in advance. Joel .:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:..:.:.:.:.:.:.:.:..:.:.:.:.:.:.:.:.:. Should computing stay as a source of benefit or become like knowledge : free and opened to every one ?... ;) ':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':'

              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