Performs an action, simulating user input via keyboard or mouse.
Parameters
- actionCode
- The action to perform.
Return Value
True if action was performed.
This snippet demonstrates how to create a user interface which allows the user to navigate the view history of a print preview. Every time the user moves to a different part of the print preview the new view is saved by the UltraPrintPreviewControl. The location in the preview, zoom factor, etc. are all saved in this history list. This is analogous to the Back and Forward history buttons in an internet browser.
For an overview of how to handle events in Visual Basic or Visual C#, see
Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see
Consuming Events in the
.NET Framework Developer's Guide.
Private Sub PrintPreviewForm_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load
' When the Form first loads, there is no view history to navigate
' so both navigation buttons should be disabled.
'
Me.btnNextPointInHistory.Enabled = False
Me.btnPrevPointInHistory.Enabled = False
End Sub
Private Sub ultraPrintPreviewControl1_ViewHistoryChanged(sender As Object, e As System.EventArgs) Handles Me.ultraPrintPreviewControl1.ViewHistoryChanged
' After the view history has been navigated we need to update the Enabled state
' of both navigation buttons in case the user has reached the beginning or end of
' the view history.
'
Me.btnNextPointInHistory.Enabled = Me.ultraPrintPreviewControl1.HasNextView
Me.btnPrevPointInHistory.Enabled = Me.ultraPrintPreviewControl1.HasPreviousView
End Sub
Private Sub btnNextPointInHistory_Click(sender As Object, e As System.EventArgs) Handles Me.btnNextPointInHistory.Click
' Make the control display the point in the view history "after" the current view point.
'
Me.ultraPrintPreviewControl1.PerformAction(Infragistics.Win.Printing.UltraPrintPreviewControlAction.NextView)
End Sub
Private Sub btnPrevPointInHistory_Click(sender As Object, e As System.EventArgs) Handles Me.btnPrevPointInHistory.Click
' Make the control display the point in the view history "before" the current view point.
'
Me.ultraPrintPreviewControl1.PerformAction(Infragistics.Win.Printing.UltraPrintPreviewControlAction.PreviousView)
End Sub
private void PrintPreviewForm_Load(object sender, System.EventArgs e)
{
// When the Form first loads, there is no view history to navigate
// so both navigation buttons should be disabled.
//
this.btnNextPointInHistory.Enabled = false;
this.btnPrevPointInHistory.Enabled = false;
}
private void ultraPrintPreviewControl1_ViewHistoryChanged(object sender, System.EventArgs e)
{
// After the view history has been navigated we need to update the Enabled state
// of both navigation buttons in case the user has reached the beginning or end of
// the view history.
//
this.btnNextPointInHistory.Enabled = this.ultraPrintPreviewControl1.HasNextView;
this.btnPrevPointInHistory.Enabled = this.ultraPrintPreviewControl1.HasPreviousView;
}
private void btnNextPointInHistory_Click(object sender, System.EventArgs e)
{
// Make the control display the point in the view history "after" the current view point.
//
this.ultraPrintPreviewControl1.PerformAction( Infragistics.Win.Printing.UltraPrintPreviewControlAction.NextView );
}
private void btnPrevPointInHistory_Click(object sender, System.EventArgs e)
{
// Make the control display the point in the view history "before" the current view point.
//
this.ultraPrintPreviewControl1.PerformAction( Infragistics.Win.Printing.UltraPrintPreviewControlAction.PreviousView );
}
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2