I believe it needs a printer installed so that it can create the appropriate
device context upon which to base the dpi, etc. I don't see how the
printpreviewdialog would work when the printpreviewcontrol does not as the
printpreviewdialog contains a printpreviewcontrol that is used to generate
and display the preview pages. With regards to the problem, the
printpreviewcontrol initiates the print when it gets a paint message so its
possible that its trying to print before events can be raised. This could be
why it seems as though the printpreviewdialog is working while the
printpreviewcontrol is not. One thing that you might try is to call the
printpreviewcontrol's InvalidatePreview method - perhaps in the form load -
so that it will regenerate the preview.
[quoted text, click to view] <jaredljensen@hotmail.com> wrote in message
news:1135970159.707660.86760@g43g2000cwa.googlegroups.com...
> Thanks Veikka. I searched the bug list and found 5 entries, none of
> which described the same problem unfortunately.
>
> Do you know if the PrintPreviewControl is supposed to work on a machine
> with no printers installed? The PrintPreviewDialog works in this
> scenario, but the PrintPreviewControl does not. I'm not sure if this
> is by design or not.
>
> Jared
>
> Veikka wrote:
>> If I remember rigth, MSDN support pages contained some topics
>> considering error you described.
>>
>> I'm not sure but I remembered that you should give a right parameter
>> to PrinterSettings ??? class that it would print at least one page.
>>
>> Check it out from Support pages.
>>
>> My problem couple weeks ago was that I could not print without
>> showing PrintDialog (there is a flag variable that should support this,
>> but
>> I is a bug).
>>
>>
>> <jaredljensen@hotmail.com> wrote in message
>> news:1135909769.246763.37200@f14g2000cwb.googlegroups.com...
>> >I have subclassed the PrintDocument class and overridden OnBeginPrint
>> > and OnPrintPage to create a reusable class for reports. My app
>> > displays these reports in a PrintPreviewControl. Everything works fine
>> > on my XP Pro SP2 (Framework v2.0) dev machine.
>> >
>> > The problem is that on some, but not all, machines (all XP) the
>> > PrintPreviewControl will simply display "Document does not contain any
>> > pages." I've verified that the BeginPrint and PrintPage events never
>> > fire. However, if I display the document in a PrintPreviewDialog, it
>> > works fine.
>> >
>> > I've verified that one of the problem machines has a valid default
>> > printer installed and that I can print to it. The only difference I
>> > can think of is that the problem machine doesn't have SP2 installed.
>> >
>> > Has anyone experienced this behavior?
>> >
>> > TIA
>> >
>> > Jared
>> >
>