當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET WorkflowView.AddDesignerMessageFilter方法代碼示例

本文整理匯總了VB.NET中System.Workflow.ComponentModel.Design.WorkflowView.AddDesignerMessageFilter方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET WorkflowView.AddDesignerMessageFilter方法的具體用法?VB.NET WorkflowView.AddDesignerMessageFilter怎麽用?VB.NET WorkflowView.AddDesignerMessageFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Workflow.ComponentModel.Design.WorkflowView的用法示例。


在下文中一共展示了WorkflowView.AddDesignerMessageFilter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: New

Public Sub New()

    Me.loaderValue = New Loader()

    ' Create a Workflow Design Surface
    Me.surface = New DesignSurface()
    Me.surface.BeginLoad(Me.loaderValue)

    ' Get the Workflow Designer Host
    If Me.surface.GetService(GetType(IDesignerHost)) IsNot Nothing AndAlso TypeOf Me.surface.GetService(GetType(IDesignerHost)) Is IDesignerHost Then
        Me.Host = CType(Me.surface.GetService(GetType(IDesignerHost)), IDesignerHost)
    Else
        Return
    End If

    ' Create a Sequential Workflow by using the Workflow Designer Host
    SequentialWorkflow = CType(Host.CreateComponent(GetType(SequentialWorkflowActivity)), SequentialWorkflowActivity)
    SequentialWorkflow.Name = "CustomOutlookWorkflow"

    ' Create a Workflow View on the Workflow Design Surface
    Me.workflowView = New WorkflowView(CType(Me.surface, IServiceProvider))

    ' Add a message filter to the workflow view, to support panning
    Dim filter As MessageFilter = New MessageFilter(CType(Me.surface, IServiceProvider), Me.workflowView)
    Me.workflowView.AddDesignerMessageFilter(filter)

    ' Activate the Workflow View
    Me.Host.Activate()

    Me.workflowView.Dock = DockStyle.Fill
    Me.Controls.Add(workflowView)
    Me.Dock = DockStyle.Fill
End Sub
開發者ID:VB.NET開發者,項目名稱:System.Workflow.ComponentModel.Design,代碼行數:33,代碼來源:WorkflowView.AddDesignerMessageFilter

示例2: New

Friend Class MessageFilter
    Inherits WorkflowDesignerMessageFilter

    Private mouseDown As Boolean
    Private serviceProvider As IServiceProvider
    Private workflowView As WorkflowView

    Public Sub New(ByVal provider As IServiceProvider, ByVal view As WorkflowView)
        Me.serviceProvider = provider
        Me.workflowView = view
    End Sub

    Protected Overrides Function OnMouseDown(ByVal eventArgs As System.Windows.Forms.MouseEventArgs) As Boolean
        ' Allow other components to process this event by not returning true.
        Me.mouseDown = True
        Return False
    End Function
    Protected Overrides Function OnMouseMove(ByVal eventArgs As System.Windows.Forms.MouseEventArgs) As Boolean
        ' Allow other components to process this event by not returning true.
        If (Me.mouseDown) Then
            Me.workflowView.ScrollPosition = New Point(eventArgs.X, eventArgs.Y)
        End If
        Return False
    End Function
    Protected Overrides Function OnMouseUp(ByVal eventArgs As System.Windows.Forms.MouseEventArgs) As Boolean
        ' Allow other components to process this event by not returning true.
        Me.mouseDown = False
        Return False
    End Function

    Protected Overrides Function OnMouseDoubleClick(ByVal eventArgs As System.Windows.Forms.MouseEventArgs) As Boolean
        Me.mouseDown = False
        Return True
    End Function

    Protected Overrides Function OnMouseEnter(ByVal eventArgs As System.Windows.Forms.MouseEventArgs) As Boolean
        ' Allow other components to process this event by not returning true.
        Me.mouseDown = False
        Return False
    End Function

    Protected Overrides Function OnMouseHover(ByVal eventArgs As System.Windows.Forms.MouseEventArgs) As Boolean
        ' Allow other components to process this event by not returning true.
        Me.mouseDown = False
        Return False
    End Function

    Protected Overrides Function OnMouseLeave() As Boolean
        ' Allow other components to process this event by not returning true.
        Me.mouseDown = False
        Return False
    End Function

    Protected Overrides Function OnMouseWheel(ByVal eventArgs As System.Windows.Forms.MouseEventArgs) As Boolean
        Me.mouseDown = False
        Return True
    End Function

    Protected Overrides Function OnMouseCaptureChanged() As Boolean
        ' Allow other components to process this event by not returning true.
        Me.mouseDown = False
        Return False
    End Function

    Protected Overrides Function OnDragEnter(ByVal eventArgs As System.Windows.Forms.DragEventArgs) As Boolean
        Return True
    End Function

    Protected Overrides Function OnDragOver(ByVal eventArgs As System.Windows.Forms.DragEventArgs) As Boolean
        Return True
    End Function

    Protected Overrides Function OnDragLeave() As Boolean
        Return True
    End Function

    Protected Overrides Function OnDragDrop(ByVal eventArgs As System.Windows.Forms.DragEventArgs) As Boolean
        Return True
    End Function

    Protected Overrides Function OnGiveFeedback(ByVal eventArgs As System.Windows.Forms.GiveFeedbackEventArgs) As Boolean
        Return True
    End Function

    Protected Overrides Function OnQueryContinueDrag(ByVal eventArgs As System.Windows.Forms.QueryContinueDragEventArgs) As Boolean
        Return True
    End Function

    Protected Overrides Function OnKeyUp(ByVal eventArgs As System.Windows.Forms.KeyEventArgs) As Boolean
        Return True
    End Function

    Protected Overrides Function OnShowContextMenu(ByVal screenMenuPoint As System.Drawing.Point) As Boolean
        Return True
    End Function

    Protected Overrides Function OnKeyDown(ByVal eventArgs As System.Windows.Forms.KeyEventArgs) As Boolean
        If eventArgs.KeyCode = Keys.Delete Then
            Dim selectionService As ISelectionService = CType(Me.serviceProvider.GetService(GetType(ISelectionService)), ISelectionService)
            If selectionService IsNot Nothing AndAlso TypeOf selectionService.PrimarySelection Is CodeActivity Then
                Dim codeActivityComponent As CodeActivity = CType(selectionService.PrimarySelection, CodeActivity)
                Dim parentActivity As CompositeActivity = codeActivityComponent.Parent
                If parentActivity IsNot Nothing Then
                    parentActivity.Activities.Remove(codeActivityComponent)
                    Me.ParentView.Update()
                End If
            End If
        End If
        Return True
    End Function
End Class
開發者ID:VB.NET開發者,項目名稱:System.Workflow.ComponentModel.Design,代碼行數:111,代碼來源:WorkflowView.AddDesignerMessageFilter


注:本文中的System.Workflow.ComponentModel.Design.WorkflowView.AddDesignerMessageFilter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。