Re: Bitmap in CStatic is not redrawn
"mattgreenrocks" <mattgreenrocks-/[email protected]>
| Newsgroups | gmane.comp.windows.wtl |
|---|---|
| Message-ID | <[email protected]> |
Well, I'm embarrassed to report that I discovered the problem: passing a NULL HBITMAP to the static control before DlgResize_Init() was called. My guess is that the initial size of the control was 0 x 0, as it had no picture contained, and that was the size saved by CDialogResize, and subsequently used after it finished laying out the dialog. --- In [email protected], "mattgreenrocks" <mattgreenrocks@...> wrote: > > I'm writing a media player using WTL, and I've encountered a problem. An image contained in a CStatic control ends up disappearing after either resizing, or minimizing/maximizing the application. > > When the user starts to play an audio file, it looks for the accompanying album art. If it is found, I use GDI+ to scale the image down nicely, saving the resulting Gdiplus::Bitmap* to a member variable (read: keeping it in scope). Then, I call GetHBITMAP(), and pass that to CStatic::SetBitmap(). The image shows up on the main dialog, and life is good...until it needs to be redrawn. Then, it just disappears completely. I tried adding the redraw flag to my CDialogResize map, but it didn't seem to fix it. > > Is my HBITMAP no longer valid after a redraw of the area takes place? If I go to another track, then the art for the second track shows up fine. > ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/wtl/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/wtl/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/