views:

214

answers:

1

I want to draw a HBITMAP onto HDC,

I used StretchDIBits. It works fine. ::StretchDIBits.

however, I only want a window to watch the drawing result, beside the window, I wish the stretchDIBits do not take any effect(It can not draw on other area), how can I do this?

+2  A: 

When a child window is created, make sure the WS_CLIPSIBLINGS style is set to disallow painting outside the client area in WM_PAINT.

Other than that, SelectClipRegion is probably what you want.

Johann Gerell
Thanks, I used SelectClipRgn, It works! Another question, how to cancel SelectClipRgn's effect after drawing? then, other process can work on the total hdc
Cancel by calling with a NULL region. If you liked the answer, then, maybe, you could upvote me a bit... ;-)
Johann Gerell
thanks:) I will do it ;)