copy hdc contents to bitmap

北战南征 提交于 2019-11-30 17:23:53

问题


How could you copy the contents of an HDC to a bitmap?


回答1:


Off the top of my head I think you need to:

  • Create a new DC compatible with the source DC. Call this the memory DC.
  • Create a new bitmap of the correct size.
  • Select the bitmap into the memory DC.
  • BitBlt the source DC into the memory DC.
  • The bitmap should now contain a copy of the source DC.

I'm at home so can't give you any code, so I hope this is enough to get you started. There is a good GDI section on Code Project.

http://www.codeproject.com/KB/graphics/




回答2:


There is a good piece of sample code here that does just that (amongst other things).

I've used a similar technique before (many moons ago), but do not have the code to hand.



来源:https://stackoverflow.com/questions/351236/copy-hdc-contents-to-bitmap

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!