How to draw a part of a window into a memory device context?
Posted
by
Nell
on Stack Overflow
See other posts from Stack Overflow
or by Nell
Published on 2011-01-08T09:51:30Z
Indexed on
2011/01/08
9:53 UTC
Read the original article
Hit count: 191
I'm using simple statements to keep it, er, simple:
- The screen goes from 0, 0 to 1000, 1000 (screen coordinates).
- A window goes from 100, 100 to 900, 900 (screen coordinates).
- I have a memory device context that goes from 0, 0 to 200, 200 (logical coordinates).
I need to send a WM_PRINT message to the window. I can pass the device context to the window via WM_PRINT, but I cannot pass which part of its window it should draw into the device context.
Is there some way to alter the device context that will result in the window drawing a specific part of itself into the device context (say, its bottom right portion from 700, 700 to 900, 900)?
(This is all under plain old GDI and in C or C++. Any solution must be too.)
Please note: This problem is part of a larger solution in which the device context size is fixed and speed is crucial, so I cannot draw the window in full into a separate device context and blit the part I want from the resultant full bitmap into my device context.
© Stack Overflow or respective owner