开发者

How to associate a MFC DC with QPrinter?

开发者 https://www.devze.com 2023-01-06 03:03 出处:网络
I was just wondering if it is possible to use my existing MFC created DC to associate with a QPrinter so that it directly uses the existing DC rather creates its own with QPrintDialog?

I was just wondering if it is possible to use my existing MFC created DC to associate with a QPrinter so that it directly uses the existing DC rather creates its own with QPrintDialog?

Does QPrinter make use of Qt's backingstore as QWidget does, i.e., does it create an off开发者_JAVA百科-screen image before printing?


First thing: QPrintDialog has nothing to do with your question. You can set-up a QPrinter without using QPrintDialog.

Anyway: You paint into a QPainter where QPrinter is "only" the printing device. Printing only starts when you end the QPainter. So there is a backing store when using QPrinter.

You can't convert a DC to a QPainter so QPrinter can't do anything with a DC. The closest thing would be to get a Bitmap from the DC and print it to a fresh QPainter.

0

精彩评论

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