开发者

Repainting image after going to full screen and back in C++/CLI

I'm building application, which paints raw bitmap images on label's hdc using StrechDIBits.

ptr = g->GetHdc();
dc = (HDC)ptr.ToInt32 ();
SetStretchBltMode (dc, COLORONCOLOR);
StretchDIBits (dc, 0, 0, (int) (LabelPictureShow->Width), (int) (LabelPictureShow->Height), 0, 0, width, height, data, bitmapInfo, DIB_RGB_COLORS, SRCCOPY);    
 g->ReleaseHdc (ptr);

This way I draw whole videostream, one picture from stream after another, which works perfect. I have also function which resize my form and label over whole screen for realizing a full screen, wchich also works great when playing video.

But, when I stop the video or send only one picture and call the full scren function. It will not repaint the image and that's my problem. I tried to use Paint Event, Resize Event both of form and label for painting the image again after resizing, but nothing works. When I get fullscreen or back to normal size, my image flashes for short mo开发者_开发知识库ment but then it's repainted by control's color and dissappears. I've tried to put the painting code with StretchDIBits everywhere both nothing works. Any help or advice is really appreciated.

edit:the sad thing for me is, that when i put the painting code in, for example, click event of label, it works fine...


Solved by using custom PaintBox control used in other project. This control uses overwritten OnPaint method where the image is redrawn. Somehow this solution works, but previous almost same solution not.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜