Displaying 2 BMPs at the same position
-
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:
-
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:
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! -
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!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 ?... ;)
-
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 ?... ;)
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! -
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 ?... ;)
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! -
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!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 ?... ;) ':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':'
-