Spread Windows Forms 12.0 Product Documentation
PrintMessageBox Event
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > FpSpread Class : PrintMessageBox Event
Occurs before and after a print job.
Syntax
'Declaration
 
Public Event PrintMessageBox As PrintMessageBoxEventHandler
'Usage
 
Dim instance As FpSpread
Dim handler As PrintMessageBoxEventHandler
 
AddHandler instance.PrintMessageBox, handler
public event PrintMessageBoxEventHandler PrintMessageBox
Event Data

The event handler receives an argument of type PrintMessageBoxEventArgs containing data related to this event. The following PrintMessageBoxEventArgs properties provide information specific to this event.

PropertyDescription
Gets the message displayed if the print job is canceled.  
Gets whether the print job is beginning or ending.  
Gets or sets whether to cancel the default abort message box.  
Gets the print job identifier.  
Gets whether this event is for the print preview.  
Remarks

This event is raised by the OnPrintMessageBox method when the print job is started or ended.

The print message box displays the print job name, if provided, and lets users cancel the print job.

If you want to provide a name for a print job, set the PrintInfo.JobName property.

For more details on the individual event arguments, refer to PrintMessageBoxEventArgs members.

The PrintCancelled event can be used when the print job is cancelled.

Example
This example raises the PrintMessageBox event when the print job is started or ended.
private void menu_Click(object sender, System.EventArgs e)
{
     FarPoint.Win.Spread.PrintInfo pi = new FarPoint.Win.Spread.PrintInfo();
     pi.AbortMessage = "Abort Printing?";
     fpSpread1.SetPrintInfo(pi,0);
     fpSpread1.PrintSheet(0);
}

private void fpSpread1_PrintMessageBox(object sender, FarPoint.Win.Spread.PrintMessageBoxEventArgs e)
{
     ListBox1.Items.Add("PrintMessageBox event fired!");
}
Private Sub Menu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem23.Click
     Dim pi As New FarPoint.Win.Spread.PrintInfo()
     pi.AbortMessage = "Abort Printing?"
     FpSpread1.SetPrintInfo(pi, 0)
     FpSpread1.PrintSheet(0)
End Sub

Private Sub FpSpread1_PrintMessageBox(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.PrintMessageBoxEventArgs) Handles
FpSpread1.PrintMessageBox
     ListBox1.Items.Add("PrintMessageBox event fired!")
End Sub
See Also