Implementing my own print preview?

后端 未结 4 546
别那么骄傲
别那么骄傲 2021-01-03 04:48

I have developed my own Report Control which is simply nothing but drawing text on a CDC of the control window\'s client DC. I have got the printing function to work too. Th

相关标签:
4条回答
  • 2021-01-03 05:10

    if you managed to print your output to a file in an RTF format and displayed it on screen would this solve the problem?

    0 讨论(0)
  • 2021-01-03 05:31

    I had tweeked this code in order to compile it as static lib. It is for dialog based applications.
    If you don't need special functionality it will work ok for you.

    I had to dig through MFC mechanisms to add extra functionality but at the end I dropped it. If you know other programming languages, try to find a print preview control in that language, make it a dll and use it from your MFC application.

    For example, I found the NicePreview control for Delphi and it worked, for me, beautifully !

    0 讨论(0)
  • 2021-01-03 05:33

    Print preview isn't that special. It just means that you have to render to screen (or bitmap) what you'd otherwise would render to the printer DC. This primarly means using the page size, and providing a UI control for the prev/next page.

    0 讨论(0)
  • 2021-01-03 05:33

    There is a class CPreviewView in MFC. Maybe you can find a way to instantiate it without MDI structure.

    Otherwise, you can simply paint on screen whatever you are painting on the printer DC. Just remember that you will probably need to scale it down for lower dpi.

    0 讨论(0)
提交回复
热议问题