WorkflowView.Zoom 属性

定义

获取或设置 WorkflowView 的缩放级别。

public:
 property int Zoom { int get(); void set(int value); };
public int Zoom { get; set; }
member this.Zoom : int with get, set
Public Property Zoom As Integer

属性值

WorkflowView 的缩放级别。

例外

如果缩放级别小于 AmbientTheme 的最小缩放级别

- 或 -

如果缩放级别超过 AmbientTheme 的最大缩放级别。

示例

以下示例演示如何设置 ZoomWorkflowView 属性。

此代码示例摘自 MainForm.cs 文件中的工作流监视器 SDK 示例。 有关详细信息,请参阅 工作流监视器示例

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;
    }
}
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

注解

使用缩放功能可以在 WorkflowView 内放大或缩小组件的大小。 AmbientTheme 设置 WorkflowView 的最小和最大缩放级别。

适用于