PrintPreviewControl: changing the preview pages order

M

Marco Segurini

Hi all,

I am adding printpreview to my application.
For this I am doing some tests with PrintPreviewControl.

Let's suppose that my document needs a matrix 3x4 = 12 sheets to be print.

To preview the complete document I set:

PrintPreviewControl printPreviewCtrl = new PrintPreviewControl();
....
_printPreviewCtrl.StartPage = 0;
_printPreviewCtrl.Row = 3;
_printPreviewCtrl.Column = 4;

which shows the following matrix of pages:
0 1 2 3
4 5 6 7
8 0 10 11


Now I set:
_printPreviewCtrl.StartPage = 0;
_printPreviewCtrl.Row = 2;
_printPreviewCtrl.Column = 2;

and I get the matrix:
0 1
2 3

PROBLEM: I am looking for a way to show this matrix instead:
0 1
4 5

Many thanks in advance.

Marco.
 
N

Nicholas Paldino [.NET/C# MVP]

Marco,

In order to do this, you will have to set a flag somewhere indicating
that you are performing a preview, a flag where the event handler for the
PrintPage event on the PrintDocument can access it. Then, in that event
handler, when you see the flag set, you would know to render only pages 0,
1, 4 and 5.
 
M

Marco Segurini

Nicholas Paldino [.NET/C# MVP] ha scritto:
Marco,

In order to do this, you will have to set a flag somewhere indicating
that you are performing a preview, a flag where the event handler for the
PrintPage event on the PrintDocument can access it. Then, in that event
handler, when you see the flag set, you would know to render only pages 0,
1, 4 and 5.
Thanks Nicholas,

but this means I have to to recreate all (and only) the pages I have to
display every time I modify one of these properties { StartPage, Rows,
Columns } even if I have make no modifications on the document.
This may be very slow.

My case is this:
1) the PrintPreviewControl creates all the pages only once (when it is
loaded).
2) I use the { StartPage, Rows, Columns, Zoom } properties that do not
recreate the pages.

I am looking for a way to select a subset from the set of all pages
already created.

Marco.
 
N

Nicholas Paldino [.NET/C# MVP]

Marco,

That option isn't available to you. You will have to probably remove
the control and re-add it with the new rows/columns and then re-render the
page.

You can probably optimize the PrintPage event handler so that you don't
have to recalc so much when you re-render the pages.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Marco Segurini said:
Nicholas Paldino [.NET/C# MVP] ha scritto:
Marco,

In order to do this, you will have to set a flag somewhere indicating
that you are performing a preview, a flag where the event handler for the
PrintPage event on the PrintDocument can access it. Then, in that event
handler, when you see the flag set, you would know to render only pages
0, 1, 4 and 5.
Thanks Nicholas,

but this means I have to to recreate all (and only) the pages I have to
display every time I modify one of these properties { StartPage, Rows,
Columns } even if I have make no modifications on the document.
This may be very slow.

My case is this:
1) the PrintPreviewControl creates all the pages only once (when it is
loaded).
2) I use the { StartPage, Rows, Columns, Zoom } properties that do not
recreate the pages.

I am looking for a way to select a subset from the set of all pages
already created.

Marco.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top