L
Lars
Hi,
I have created a simple custom PrintPreviewDialog consisting of a simple
standard PrintPreviewControl (.NET 1.1) on a WindowsForm with a few buttons
(for printing, zooming, etc.). It is working fine, except for that I cannot
figure out how display the waitcursor / hourglass while the preview is
preparing to show the document *and then go back to the default cursor when
the document is displayed*. Turning on the waitcursor is easy, but what
event should I hook into to turn it off??
What happens when I preview a document that is about 50 pages long is that
you get the blank form on the screen and then nothing happens for maybe 40
seconds and then you get a "Generating Preview" message and then the
document is displayed. It is during the initial 40 seconds that I need an
hourglass or something to let the users know that something is happening in
the background.
Here are some snippets of what I am doing currently:
// Constructor:
public PreviewDialog(System.Drawing.Printing.PrintDocument printDocument,
int zoom)
{
InitializeComponent();
_printDocument = printDocument;
_zoom = zoom;
}
private void PreviewDialog_Load(object sender, System.EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
Initialize();
//this.Cursor = Cursors.Default; // This gets hit instantly, so you
never see an hourglass.
}
private void Initialize()
{
uxPrintPreview.Anchor = AnchorStyles.Bottom | AnchorStyles.Top |
AnchorStyles.Left | AnchorStyles.Right;
uxPrintPreview.Zoom = zoom;
this.WindowState = FormWindowState.Maximized;
uxPrintPreview.Document = printDocument1 = printDocument;
}
// The calling code:
using (PreviewDialog form = new PreviewDialog(c1Report1.Document))
{
form.ShowDialog(this);
}
If there was an event like LastPageFinished or DocumentRendered or similar
in the PrintPreviewControl, I would be home free, but I cannot find anything
like that.
Any help on this would be greatly appreciated.
Thanks,
Lars
I have created a simple custom PrintPreviewDialog consisting of a simple
standard PrintPreviewControl (.NET 1.1) on a WindowsForm with a few buttons
(for printing, zooming, etc.). It is working fine, except for that I cannot
figure out how display the waitcursor / hourglass while the preview is
preparing to show the document *and then go back to the default cursor when
the document is displayed*. Turning on the waitcursor is easy, but what
event should I hook into to turn it off??
What happens when I preview a document that is about 50 pages long is that
you get the blank form on the screen and then nothing happens for maybe 40
seconds and then you get a "Generating Preview" message and then the
document is displayed. It is during the initial 40 seconds that I need an
hourglass or something to let the users know that something is happening in
the background.
Here are some snippets of what I am doing currently:
// Constructor:
public PreviewDialog(System.Drawing.Printing.PrintDocument printDocument,
int zoom)
{
InitializeComponent();
_printDocument = printDocument;
_zoom = zoom;
}
private void PreviewDialog_Load(object sender, System.EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
Initialize();
//this.Cursor = Cursors.Default; // This gets hit instantly, so you
never see an hourglass.
}
private void Initialize()
{
uxPrintPreview.Anchor = AnchorStyles.Bottom | AnchorStyles.Top |
AnchorStyles.Left | AnchorStyles.Right;
uxPrintPreview.Zoom = zoom;
this.WindowState = FormWindowState.Maximized;
uxPrintPreview.Document = printDocument1 = printDocument;
}
// The calling code:
using (PreviewDialog form = new PreviewDialog(c1Report1.Document))
{
form.ShowDialog(this);
}
If there was an event like LastPageFinished or DocumentRendered or similar
in the PrintPreviewControl, I would be home free, but I cannot find anything
like that.
Any help on this would be greatly appreciated.
Thanks,
Lars