WorkflowDesignerMessageFilter Class
Assembly: System.Workflow.ComponentModel (in system.workflow.componentmodel.dll)
'Declaration Public MustInherit Class WorkflowDesignerMessageFilter Implements IDisposable 'Usage Dim instance As WorkflowDesignerMessageFilter
public abstract class WorkflowDesignerMessageFilter implements IDisposable
public abstract class WorkflowDesignerMessageFilter implements IDisposable
Not applicable.
The workflow designer provides a Strategy design pattern to create replaceable message filter objects to handle events.
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. 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.
The following code example demonstrates a custom designer message filter that derives from WorkflowDesignerMessageFilter. The class, named CustomMessageFilter, overrides a number of its base class methods including OnMouseDown, OnMouseMove, OnMouseUp, OnMouseDoubleClick, OnMouseEnter, OnMouseHover, OnMouseLeave, OnDragEnter, OnDragOver, and OnKeyDown.
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 Contructor 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 }
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.