WorkflowDesignerMessageFilter WorkflowDesignerMessageFilter WorkflowDesignerMessageFilter WorkflowDesignerMessageFilter Class

定義

警告

この API は現在使われていません。

すべてのワークフロー メッセージ フィルターの基本クラスを提供します。Provides a base class for all workflow message filters.

public ref class WorkflowDesignerMessageFilter abstract : IDisposable
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public abstract class WorkflowDesignerMessageFilter : IDisposable
type WorkflowDesignerMessageFilter = class
    interface IDisposable
Public MustInherit Class WorkflowDesignerMessageFilter
Implements IDisposable
継承
WorkflowDesignerMessageFilterWorkflowDesignerMessageFilterWorkflowDesignerMessageFilterWorkflowDesignerMessageFilter
属性
実装

WorkflowDesignerMessageFilter から派生したカスタム デザイナー メッセージ フィルターのコード例を、次に示します。The following code example shows a custom designer message filter that derives from WorkflowDesignerMessageFilter. CustomMessageFilter という名前のクラスは、その基本クラスの多数のメソッドをオーバーライドします。オーバーライドされるメソッドには、OnMouseDownOnMouseMoveOnMouseUpOnMouseDoubleClickOnMouseEnterOnMouseHoverOnMouseLeaveOnDragEnterOnDragOverOnKeyDown があります。The class, named CustomMessageFilter, overrides a number of its base class methods including OnMouseDown, OnMouseMove, OnMouseUp, OnMouseDoubleClick, OnMouseEnter, OnMouseHover, OnMouseLeave, OnDragEnter, OnDragOver, and OnKeyDown.

このコード例は、DesignerShell.cs ファイルから抜粋した Basic Designer Hosting の SDK サンプルの一部です。This code example is part of the Basic Designer Hosting SDK Sample from the DesignerShell.cs file. 詳細については、次を参照してください。基本デザイナー ホスティングします。For more information, see Basic Designer Hosting.

internal sealed class CustomMessageFilter : WorkflowDesignerMessageFilter
{
    #region Members and Constructor

    private bool mouseDown;
    private IServiceProvider serviceProvider;
    private WorkflowView workflowView;
    private WorkflowDesignerLoader loader;

    public CustomMessageFilter(IServiceProvider provider, WorkflowView workflowView, WorkflowDesignerLoader loader)
    {
        this.serviceProvider = provider;
        this.workflowView = workflowView;
        this.loader = loader;
    }

    #endregion

    #region MessageFilter Overridables

    protected override bool OnMouseDown(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        this.mouseDown = true;
        return false;
    }

    protected override bool OnMouseMove(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        if (mouseDown)
        {
            workflowView.ScrollPosition = new Point(eventArgs.X, eventArgs.Y);
        }
        return false;
    }

    protected override bool OnMouseUp(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnMouseDoubleClick(MouseEventArgs eventArgs)
    {
        mouseDown = false;
        return true;
    }

    protected override bool OnMouseEnter(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnMouseHover(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnMouseLeave()
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnMouseWheel(MouseEventArgs eventArgs)
    {
        mouseDown = false;
        return true;
    }

    protected override bool OnMouseCaptureChanged()
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnDragEnter(DragEventArgs eventArgs)
    {
        return true;
    }

    protected override bool OnDragOver(DragEventArgs eventArgs)
    {
        return true;
    }

    protected override bool OnDragLeave()
    {
        return true;
    }

    protected override bool OnDragDrop(DragEventArgs eventArgs)
    {
        return true;
    }

    protected override bool OnGiveFeedback(GiveFeedbackEventArgs gfbevent)
    {
        return true;
    }

    protected override bool OnQueryContinueDrag(QueryContinueDragEventArgs qcdevent)
    {
        return true;
    }

    protected override bool OnKeyDown(KeyEventArgs eventArgs)
    {
        if (eventArgs.KeyCode == Keys.Delete)
        {
            ISelectionService selectionService = (ISelectionService)serviceProvider.GetService(typeof(ISelectionService));
            if (selectionService != null && selectionService.PrimarySelection is CodeActivity)
            {
                CodeActivity codeActivityComponent = (CodeActivity)selectionService.PrimarySelection;
                CompositeActivity parentActivity = codeActivityComponent.Parent;
                if (parentActivity != null)
                {
                    parentActivity.Activities.Remove(codeActivityComponent);
                    this.ParentView.Update();
                }
                loader.RemoveActivityFromDesigner(codeActivityComponent);

            }
        }
        return true;
    }

    protected override bool OnKeyUp(KeyEventArgs eventArgs)
    {
        return true;
    }

    protected override bool OnShowContextMenu(Point menuPoint)
    {
        return true;
    }

    #endregion
}
    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

注釈

注意

ここでは、廃止された型と名前空間について説明します。This material discusses types and namespaces that are obsolete. 詳細については、「.NET 4.5 での Windows Workflow Foundation の新機能」を参照してください。For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

ワークフロー デザイナーは、イベント処理用に置換可能なメッセージ フィルター オブジェクトを作成するための Strategy デザイン パターンを提供します。The workflow designer provides a Strategy design pattern to create replaceable message filter objects to handle events.

WorkflowDesignerMessageFilter クラスから派生して、ワークフロー デザイナー イベント (ドラッグ操作、レイアウトとペイント操作、その他のデザイナー イベント) に応答できるメッセージ フィルターを作成します。Derive from the WorkflowDesignerMessageFilter class to create message filters that can respond to workflow designer events, such as drag operations, layout and paint operations, and other designer events. カスタム メッセージ フィルターをメッセージ フィルター チェーンに追加するには、 AddDesignerMessageFilterWorkflowView を呼び出すか、カスタム ルート アクティビティで MessageFilters 仮想プロパティをオーバーライドして、基本クラスから返されたコレクションにカスタム メッセージ フィルターを追加します。To add a custom message filter to the message filters chain, call the AddDesignerMessageFilter on the WorkflowView or override the MessageFilters virtual property on the custom root activity and add the custom message filter to the collection returned from the base class.

コンストラクター

WorkflowDesignerMessageFilter() WorkflowDesignerMessageFilter() WorkflowDesignerMessageFilter() WorkflowDesignerMessageFilter()

派生クラスとして実装された場合、WorkflowDesignerMessageFilter のインスタンスを初期化します。When implemented in a derived class, initializes an instance of a WorkflowDesignerMessageFilter.

プロパティ

MessageHitTestContext MessageHitTestContext MessageHitTestContext MessageHitTestContext

HitTestInfo のコンテキストを示す WorkflowDesignerMessageFilter を取得します。Gets the HitTestInfo that describes the context of the WorkflowDesignerMessageFilter.

ParentView ParentView ParentView ParentView

WorkflowView に関連付けられている WorkflowDesignerMessageFilter を取得します。Gets the WorkflowView that is associated with the WorkflowDesignerMessageFilter.

メソッド

Dispose() Dispose() Dispose() Dispose()

WorkflowDesignerMessageFilter で使用したリソースを解放します。Releases the resources used by the WorkflowDesignerMessageFilter.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

WorkflowDesignerMessageFilter によって使用されているアンマネージド リソースを解放し、オプションでマネージド リソースも解放します。Releases the unmanaged resources used by the WorkflowDesignerMessageFilter and optionally releases the managed resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize() Finalize() Finalize() Finalize()

ガベージ コレクションでオブジェクトがクリアされる前に、Dispose(false) を呼び出して、リソースの解放を試みます。Attempts to free resources by calling Dispose(false) before the object is reclaimed by garbage collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

既定のハッシュ関数として機能します。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

(Inherited from Object)
Initialize(WorkflowView) Initialize(WorkflowView) Initialize(WorkflowView) Initialize(WorkflowView)

関連付けられた WorkflowDesignerMessageFilter を使用して WorkflowView を初期化します。Initializes the WorkflowDesignerMessageFilter with the associated WorkflowView.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
OnDragDrop(DragEventArgs) OnDragDrop(DragEventArgs) OnDragDrop(DragEventArgs) OnDragDrop(DragEventArgs)

ドラッグ操作中にオブジェクト上でマウス ボタンが離されると発生します。Occurs when the mouse button is released above an object during a drag operation.

OnDragEnter(DragEventArgs) OnDragEnter(DragEventArgs) OnDragEnter(DragEventArgs) OnDragEnter(DragEventArgs)

ドラッグ操作中にマウス ポインターがオブジェクトの境界内に入ると発生します。Occurs when the mouse pointer enters the bounds of an object during a drag operation.

OnDragLeave() OnDragLeave() OnDragLeave() OnDragLeave()

ドラッグ操作中にマウス ポインターがオブジェクトの境界から出ると発生します。Occurs when the mouse pointer leaves the bounds of an object during a drag operation.

OnDragOver(DragEventArgs) OnDragOver(DragEventArgs) OnDragOver(DragEventArgs) OnDragOver(DragEventArgs)

ドラッグ操作中にマウス ポインターがオブジェクトの境界内を移動すると発生します。Occurs when the mouse pointer moves within the bounds of an object during a drag operation.

OnGiveFeedback(GiveFeedbackEventArgs) OnGiveFeedback(GiveFeedbackEventArgs) OnGiveFeedback(GiveFeedbackEventArgs) OnGiveFeedback(GiveFeedbackEventArgs)

ドラッグ操作中に発生します。Occurs during a drag operation.

OnKeyDown(KeyEventArgs) OnKeyDown(KeyEventArgs) OnKeyDown(KeyEventArgs) OnKeyDown(KeyEventArgs)

キーが押されたときに発生します。Occurs when a key is pressed.

OnKeyUp(KeyEventArgs) OnKeyUp(KeyEventArgs) OnKeyUp(KeyEventArgs) OnKeyUp(KeyEventArgs)

キーが離されたときに発生します。Occurs when a key is released.

OnLayout(LayoutEventArgs) OnLayout(LayoutEventArgs) OnLayout(LayoutEventArgs) OnLayout(LayoutEventArgs)

子オブジェクトを再配置する必要があるときに発生します。Occurs when child objects should be repositioned.

OnMouseCaptureChanged() OnMouseCaptureChanged() OnMouseCaptureChanged() OnMouseCaptureChanged()

マウスをドラッグして選択された項目が変わったときに発生します。Occurs when the items selected by dragging the mouse changes.

OnMouseDoubleClick(MouseEventArgs) OnMouseDoubleClick(MouseEventArgs) OnMouseDoubleClick(MouseEventArgs) OnMouseDoubleClick(MouseEventArgs)

マウスがダブルクリックされたときに発生します。Occurs when you double-click the mouse.

OnMouseDown(MouseEventArgs) OnMouseDown(MouseEventArgs) OnMouseDown(MouseEventArgs) OnMouseDown(MouseEventArgs)

マウス ボタンがクリックされると発生します。Occurs when a mouse button is clicked.

OnMouseEnter(MouseEventArgs) OnMouseEnter(MouseEventArgs) OnMouseEnter(MouseEventArgs) OnMouseEnter(MouseEventArgs)

マウス ポインターがオブジェクトの境界内に入ったときに発生します。Occurs when the mouse pointer enters the bounds of an object.

OnMouseHover(MouseEventArgs) OnMouseHover(MouseEventArgs) OnMouseHover(MouseEventArgs) OnMouseHover(MouseEventArgs)

マウス ポインターがオブジェクト上に置かれたときに発生します。Occurs when the mouse pointer pauses above an object.

OnMouseLeave() OnMouseLeave() OnMouseLeave() OnMouseLeave()

マウス ポインターがオブジェクトの境界から出たときに発生します。Occurs when the mouse pointer leaves the bounds of an object.

OnMouseMove(MouseEventArgs) OnMouseMove(MouseEventArgs) OnMouseMove(MouseEventArgs) OnMouseMove(MouseEventArgs)

マウス ポインターがオブジェクトの境界内で移動すると発生します。Occurs when the mouse pointer moves while within the bounds of an object.

OnMouseUp(MouseEventArgs) OnMouseUp(MouseEventArgs) OnMouseUp(MouseEventArgs) OnMouseUp(MouseEventArgs)

マウス ボタンが離されると発生します。Occurs when the mouse button is released.

OnMouseWheel(MouseEventArgs) OnMouseWheel(MouseEventArgs) OnMouseWheel(MouseEventArgs) OnMouseWheel(MouseEventArgs)

マウス ホイールが動くと発生します。Occurs when the mouse wheel moves.

OnPaint(PaintEventArgs, Rectangle, AmbientTheme) OnPaint(PaintEventArgs, Rectangle, AmbientTheme) OnPaint(PaintEventArgs, Rectangle, AmbientTheme) OnPaint(PaintEventArgs, Rectangle, AmbientTheme)

描画メッセージを受け取ると発生します。Occurs when a paint message is received.

OnPaintWorkflowAdornments(PaintEventArgs, Rectangle, AmbientTheme) OnPaintWorkflowAdornments(PaintEventArgs, Rectangle, AmbientTheme) OnPaintWorkflowAdornments(PaintEventArgs, Rectangle, AmbientTheme) OnPaintWorkflowAdornments(PaintEventArgs, Rectangle, AmbientTheme)

ワークフローが修飾を再描画する必要があるときに発生します。Occurs when the workflow should repaint its adornments.

OnQueryContinueDrag(QueryContinueDragEventArgs) OnQueryContinueDrag(QueryContinueDragEventArgs) OnQueryContinueDrag(QueryContinueDragEventArgs) OnQueryContinueDrag(QueryContinueDragEventArgs)

ドラッグ操作中に発生します。Occurs during a drag operation.

OnScroll(ScrollBar, Int32) OnScroll(ScrollBar, Int32) OnScroll(ScrollBar, Int32) OnScroll(ScrollBar, Int32)

ユーザーがワークフロー デザイナーでスクロールすると発生します。Occurs when a user scrolls in a workflow designer.

OnShowContextMenu(Point) OnShowContextMenu(Point) OnShowContextMenu(Point) OnShowContextMenu(Point)

ワークフローがコンテキスト メニューを表示する必要があるときに発生します。Occurs when the workflow should show a context menu.

OnThemeChange() OnThemeChange() OnThemeChange() OnThemeChange()

ワークフローのテーマが変更されたときに発生します。Occurs when the theme of the workflow changes.

ProcessMessage(Message) ProcessMessage(Message) ProcessMessage(Message) ProcessMessage(Message)

未加工の Win32 メッセージを処理する必要があるときに発生します。Occurs when a raw Win32 message must be processed.

ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)

適用対象

こちらもご覧ください