开发者

Drawing problem does ShowWindow(hWnd, SW_HIDE) automatically invalidate rectangles?

开发者 https://www.devze.com 2022-12-27 02:22 出处:网络
I\'m running into a problem where, I have a Window that contains a child window. The child window contains another child window where a video is playing using Windows Media Player. Whenever I do call

I'm running into a problem where, I have a Window that contains a child window. The child window contains another child window where a video is playing using Windows Media Player. Whenever I do call ShowWindow (hWnd, SW_HIDE开发者_如何学运维) on the parent Window and paint over the entire surface, the region occupied by the grand-child window (where the video was playing) is not overridden. I used spy++ and found that that region which was not overridden was set to hidden BEFORE the repaint occurs.

I monitored the hwnd of the grand-child window and it did not seem to receive any WM_EraseBKGND or WM_NCPAINT messages. Does this mean the area it occupied had not been invalidated and therefore could not be drawn over? I'm new to winforms.

Thanks!


Very unclear, I have to assume that when you hide the parent window then nothing will be visible. One thing that might be relevant is that video is always displayed in a hardware overlay. That's a feature of the video adapter, it can overlay different chunks of video memory to produce a composite image. Accordingly, if you hide that video window, the parent of that window will not get a repaint message because it wasn't actually overlapped.

Use the Invalidate() method to force windows to repaint themselves. Avoid P/Invoking ShowWindow() if you can, the Visible property is always a good alternative.

0

精彩评论

暂无评论...
验证码 换一张
取 消