Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Core.Presentation / System / Activities / Core / Presentation / WorkflowShape.cs / 1305376 / WorkflowShape.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Controls; using System.Windows; using System.Windows.Input; namespace System.Activities.Core.Presentation { //Deriving from label to avoid implementing automation peer. class WorkflowShape : Label { bool isMouseDown = false; Point lastMouseDownPoint; public const double dragStartThreshold = 5; public const string WorkflowShapeFormat = "WorkflowShapeFormat"; protected override void OnMouseDown(System.Windows.Input.MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { isMouseDown = true; lastMouseDownPoint = e.GetPosition(this); e.Handled = true; } base.OnMouseDown(e); } protected override void OnMouseUp(System.Windows.Input.MouseButtonEventArgs e) { isMouseDown = false; e.Handled = true; base.OnMouseUp(e); } protected override void OnMouseMove(System.Windows.Input.MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed && isMouseDown) { Point newPosition = e.GetPosition(this); Vector difference = newPosition - lastMouseDownPoint; if (difference.Length >= dragStartThreshold) { //DoDragDrop; DataObject dataObject = new DataObject(WorkflowShapeFormat, this); DragDrop.DoDragDrop(this, dataObject, DragDropEffects.Move | DragDropEffects.Copy | DragDropEffects.Scroll | DragDropEffects.Link); isMouseDown = false; e.Handled = true; } } base.OnMouseMove(e); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TimeSpanValidator.cs
- OutOfProcStateClientManager.cs
- NetDataContractSerializer.cs
- NestPullup.cs
- ThemeDirectoryCompiler.cs
- Misc.cs
- VirtualPath.cs
- ColorBlend.cs
- ColumnCollection.cs
- ItemPager.cs
- FrameworkObject.cs
- ContractType.cs
- ListBox.cs
- AdCreatedEventArgs.cs
- DataGridViewLinkColumn.cs
- Calendar.cs
- PocoEntityKeyStrategy.cs
- IDReferencePropertyAttribute.cs
- TypeConverterValueSerializer.cs
- COM2PictureConverter.cs
- InteropAutomationProvider.cs
- DependencyObjectType.cs
- securestring.cs
- DesignRelation.cs
- ElementUtil.cs
- InvalidTimeZoneException.cs
- ClientScriptItemCollection.cs
- CallContext.cs
- Expression.cs
- EntityModelBuildProvider.cs
- xmlformatgeneratorstatics.cs
- ExpressionStringBuilder.cs
- ProfileGroupSettings.cs
- XmlQueryRuntime.cs
- VisualStyleElement.cs
- BinHexEncoder.cs
- Point4D.cs
- LinqDataSourceHelper.cs
- SiteMapNodeCollection.cs
- ParallelEnumerableWrapper.cs
- PiiTraceSource.cs
- EntityViewGenerationAttribute.cs
- Floater.cs
- Executor.cs
- coordinator.cs
- ContentOperations.cs
- DataFormats.cs
- ShadowGlyph.cs
- ChildDocumentBlock.cs
- StatusBarPanelClickEvent.cs
- EntitySet.cs
- SelectorItemAutomationPeer.cs
- SystemWebExtensionsSectionGroup.cs
- AutoGeneratedFieldProperties.cs
- Token.cs
- Vector3D.cs
- CollectionViewGroup.cs
- BrowserTree.cs
- URI.cs
- ToolStripContainer.cs
- ZoomPercentageConverter.cs
- EventDescriptorCollection.cs
- SQLRoleProvider.cs
- GuidTagList.cs
- ThreadLocal.cs
- DbConnectionPoolOptions.cs
- _SafeNetHandles.cs
- TrackBarRenderer.cs
- InfiniteIntConverter.cs
- ProgressBarAutomationPeer.cs
- SafeEventLogReadHandle.cs
- ActivationArguments.cs
- SemanticResultValue.cs
- Schema.cs
- Matrix.cs
- ShapeTypeface.cs
- XmlTextReaderImplHelpers.cs
- SystemIcmpV6Statistics.cs
- DeploymentSectionCache.cs
- ConnectionInterfaceCollection.cs
- DPCustomTypeDescriptor.cs
- XmlNamespaceDeclarationsAttribute.cs
- DispatchProxy.cs
- ScriptingRoleServiceSection.cs
- X509ThumbprintKeyIdentifierClause.cs
- FixedSchema.cs
- DataGridColumnFloatingHeader.cs
- ObjectParameterCollection.cs
- CategoryEditor.cs
- PreviewPrintController.cs
- TreeWalkHelper.cs
- documentsequencetextcontainer.cs
- Int32CollectionValueSerializer.cs
- ItemAutomationPeer.cs
- OleDbFactory.cs
- SqlDataSource.cs
- AuthenticatingEventArgs.cs
- FaultImportOptions.cs
- FileUpload.cs
- SweepDirectionValidation.cs