Pesky message box with PrintPreviewControl

CopperKettle6

Member
Joined
Dec 8, 2020
Messages
5
Programming Experience
10+
Developing an app with the MS PrintPreview Control which works ok. MS makes the point that it "Represents the raw preview part of print previewing from a Windows Forms application, without any dialog boxes or buttons." That's true - you have to add in all the programming. Except they provide a pesky "Generating Preview" message box while a PrintDocument is being prepared. Can't figure out how to suppress this box to provide my own messaging- any ideas?
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,849
Location
Sydney, Australia
Programming Experience
10+
Is that same message displayed when using a PrintPreviewDialog? If not then you could check out the source for that online to see how it does it. If so then it may be that it's not possible to suppress it. If you can't see anything in the documentation about a property to turn it off or the like, again, the source for the PrintPreviewControl may reveal something.
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,675
Location
Norway
Programming Experience
10+
I can't see that it is possible, the control overrides PrintController when generating the preview. It is described here: PreviewPrintController Class (System.Drawing.Printing)
When used with a PrintPreviewControl or PrintPreviewDialog, PreviewPrintController sets the PrintController of the associated Document to a PrintControllerWithStatusDialog, performs the print preview, and sets the PrintController back to the original value.
The swap happens in the private ComputePreview method of PrintPreviewControl class.
 

CopperKettle6

Member
Joined
Dec 8, 2020
Messages
5
Programming Experience
10+
Is that same message displayed when using a PrintPreviewDialog? If not then you could check out the source for that online to see how it does it. If so then it may be that it's not possible to suppress it. If you can't see anything in the documentation about a property to turn it off or the like, again, the source for the PrintPreviewControl may reveal something.
 

CopperKettle6

Member
Joined
Dec 8, 2020
Messages
5
Programming Experience
10+
Thanks for your reply. The answer to your question is yes which seems right because PrintPreviewDialog is to be more of a complete previewer solution. PrintPreviewControl is for custom efforts so it shouldn't have the message. Will just have to live with it apparently.
 
Top