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


VB.NET WorkflowDesignerMessageFilter類代碼示例

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


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

示例1: New

Friend NotInheritable Class CustomMessageFilter
        Inherits WorkflowDesignerMessageFilter

#Region "Members and Constructor"

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

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

#End Region

#Region "WorkflowDesignerMessageFilter Overridables"

        Protected Overrides Function OnMouseDown(ByVal eventArgs As System.Windows.Forms.MouseEventArgs) As Boolean
            ' Allow other components to process this event by not returning true.
            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 mouseDown Then
                workflowView.ScrollPosition = New Point(eventArgs.X, eventArgs.Y)
            End If
            Return False
        End Function

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

        Protected Overrides Function OnMouseDoubleClick(ByVal eventArgs As MouseEventArgs) As Boolean
            mouseDown = False
            Return True
        End Function

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

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

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

        Protected Overrides Function OnMouseWheel(ByVal eventArgs As MouseEventArgs) As Boolean
            mouseDown = False
            Return True
        End Function

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

        Protected Overrides Function OnDragEnter(ByVal eventArgs As DragEventArgs) As Boolean
            Return True
        End Function

        Protected Overrides Function OnDragOver(ByVal eventArgs As DragEventArgs) As Boolean
            Return True
        End Function

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

        Protected Overrides Function OnDragDrop(ByVal eventArgs As DragEventArgs) As Boolean
            Return True
        End Function

        Protected Overrides Function OnGiveFeedback(ByVal gfbevent As GiveFeedbackEventArgs) As Boolean
            Return True
        End Function

        Protected Overrides Function OnQueryContinueDrag(ByVal qcdevent As QueryContinueDragEventArgs) As Boolean
            Return True
        End Function

        Protected Overrides Function OnKeyDown(ByVal eventArgs As KeyEventArgs) As Boolean
            If eventArgs.KeyCode = Keys.Delete Then
                Dim selectionService As ISelectionService = CType(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
                    loader.RemoveActivityFromDesigner(codeActivityComponent)
                End If
            End If
            Return True
        End Function

        Protected Overrides Function OnKeyUp(ByVal eventArgs As KeyEventArgs) As Boolean
            Return True
        End Function

        Protected Overrides Function OnShowContextMenu(ByVal menuPoint As Point) As Boolean
            Return True
        End Function

#End Region

    End Class
開發者ID:VB.NET開發者,項目名稱:System.Workflow.ComponentModel.Design,代碼行數:125,代碼來源:WorkflowDesignerMessageFilter


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