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?

user25749
  • 4,825
  • 14
  • 61
  • 83

1 Answers1

3

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
  • 24,991
  • 10
  • 72
  • 122
  • 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 – user25749 Dec 11 '08 at 09:48
  • 1
    Cancel by calling with a NULL region. If you liked the answer, then, maybe, you could upvote me a bit... ;-) – Johann Gerell Dec 11 '08 at 10:58