The following example shows how to set the Zoom property of a WorkflowView.
This code example is part of the Workflow Monitor SDK Sample from the MainForm.cs file. For more information, see Workflow Monitor Sample.
Private Sub ToolStripComboBoxZoom_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles toolStripComboBoxZoom.SelectedIndexChanged
If workflowViewHost.WorkflowView Is Nothing Then
Return
End If
'Parse the value and set the WorkflowView zoom - set to 100% if invalid
Dim NewZoom As String = Me.toolStripComboBoxZoom.Text.Trim()
If NewZoom.EndsWith("%") Then
NewZoom = NewZoom.Substring(0, NewZoom.Length - 1)
End If
If NewZoom.Length > 0 Then
Try
Me.workflowViewHost.WorkflowView.Zoom = Convert.ToInt32(NewZoom)
Catch
Me.workflowViewHost.WorkflowView.Zoom = 100
End Try
Else
Me.workflowViewHost.WorkflowView.Zoom = 100
End If
End Sub
private void ToolStripComboBoxZoom_SelectedIndexChanged(object sender, EventArgs e)
{
if (workflowViewHost.WorkflowView == null) return;
//Parse the value and set the WorkflowView zoom - set to 100% if invalid
string newZoom = this.toolStripComboBoxZoom.Text.Trim();
if (newZoom.EndsWith("%"))
newZoom = newZoom.Substring(0, newZoom.Length - 1);
if (newZoom.Length > 0)
{
try
{
this.workflowViewHost.WorkflowView.Zoom = Convert.ToInt32(newZoom);
}
catch
{
this.workflowViewHost.WorkflowView.Zoom = 100;
}
}
else
this.workflowViewHost.WorkflowView.Zoom = 100;
}