When the current page was changed, it is raised.
Event Data
The event handler receives an argument of type AwGraphicsEventArgs containing data related to this event. The following AwGraphicsEventArgs properties provide information specific to this event.
| Property |
Description |
|
Graphics
|
Gets the GDI+ drawing surface. |
|
IsPrinter
|
Gets the value that indicates whether the drawing surface is printer. |
|
PageNumber
|
Gets the page number. |
Remarks
Property Graphics of event data is a drawing surface, describes drawing instructions to it. Executes drawing by using the method of Graphics class of the .NET Framework.
Example
How to draw when event was raised.
Private Sub printPreview_CurrentPageChanged(ByVal sender As Object, _
ByVal e As AwGraphicsEventArgs) Handles printPreview.CurrentPageChanged
' Draws a string.
Const FN As String = "Arial"
Dim brushBlk As New SolidBrush(Color.Black)
e.Graphics.DrawString("List", New Font(FN, 12), brushBlk, New RectangleF(15, 15, 180, 5))
'-------------------------
' Draws a horizontal line.
Dim pen1 As New Pen(Color.Black, 0.1F)
e.Graphics.DrawLine(pen1, 15, 25, 195, 25)
'-------------------------
' Draws different string to preview and printer
Dim text As String
If e.IsPrinter = False Then
text = "When it draws to preview"
Else
text = "When it draws to printer"
End If
e.Graphics.DrawString([text], New Font(FN, 10), brushBlk, New RectangleF(15, 35, 180, 5))
End Sub
private void printPreview_CurrentPageChanged(object sender, AwGraphicsEventArgs e)
{
// Draws a string
const string FN = "Arial";
SolidBrush brushBlk = new SolidBrush(Color.Black);
e.Graphics.DrawString("List", new Font(FN, 12), brushBlk, new RectangleF(15, 15, 180, 5));
//-------------------------
// Draws a horizontal line
Pen pen1 = new Pen(Color.Black, 0.1F);
e.Graphics.DrawLine(pen1, 15, 25, 195, 25);
//-------------------------
// Draws different string to preview and printer
string text;
if (e.IsPrinter == false)
{
text = "When it draws to preview";
}
else
{
text = "When it draws to printer";
}
e.Graphics.DrawString(text, new Font(FN, 10), brushBlk, new RectangleF(15, 35, 180, 5));
}
See Also
AwPrintPreview Class | Asterworld.PrintPreview Namespace