共用方式為


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 的最大縮放層級。

範例

下列範例將示範如何設定 的 屬性。

這個程式碼範例是 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 的最小與最大縮放層級。

適用於