Refresh/redraw controls in CFormView
-
I have a CFormView with 2 CStatic bitmaps used for backgrounds. One has an ActiveX graph control above it and the other has another bitmap. Z order is set so background bitmaps are on the bottom. Clip children and clip siblings are set. When first displayed everything looks good. After minimize/restore or covered by another window the background bitmaps display above the other controls. To test I added a button and have the handler in CFormView that does m_graph.Invalidate() and m_foregroundbitmap.Invalidate(). When pushed the graph and forground bitmap display correctly. I also tried having the button handler just do Invalidate() (for the form view) which also displays correctly. Putting Invalidate() in any other handler (i.e. OnSize, OnActivate) doesn't work. It seems that the graph and foreground bitmap update but then the background bitmaps update and draw over the others. Setting Invalidate() in OnParentNotify() from the graph control does work but unless the mouse is over the control there's no notify messages so no update. I've also tried SetWindowPos(&CWnd::wndTopMost... which didn't seem to change anything. Are there any ideas on what I might be missing or maybe another way to have controls over an image? (I need the background image because it gives a quick view to what changed in the control.) Thanks, John
-
I have a CFormView with 2 CStatic bitmaps used for backgrounds. One has an ActiveX graph control above it and the other has another bitmap. Z order is set so background bitmaps are on the bottom. Clip children and clip siblings are set. When first displayed everything looks good. After minimize/restore or covered by another window the background bitmaps display above the other controls. To test I added a button and have the handler in CFormView that does m_graph.Invalidate() and m_foregroundbitmap.Invalidate(). When pushed the graph and forground bitmap display correctly. I also tried having the button handler just do Invalidate() (for the form view) which also displays correctly. Putting Invalidate() in any other handler (i.e. OnSize, OnActivate) doesn't work. It seems that the graph and foreground bitmap update but then the background bitmaps update and draw over the others. Setting Invalidate() in OnParentNotify() from the graph control does work but unless the mouse is over the control there's no notify messages so no update. I've also tried SetWindowPos(&CWnd::wndTopMost... which didn't seem to change anything. Are there any ideas on what I might be missing or maybe another way to have controls over an image? (I need the background image because it gives a quick view to what changed in the control.) Thanks, John
Z-Order for the child controls will not work for displaying a child window on the top of another. What you can do is instead of using a CStatic control for displaying the bitmap, you can render the bitmap directly on to the parent window.