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
- TextTreeObjectNode.cs
- RangeValuePatternIdentifiers.cs
- HostExecutionContextManager.cs
- XmlComplianceUtil.cs
- AvTraceDetails.cs
- NativeCppClassAttribute.cs
- WebCategoryAttribute.cs
- SchemaElement.cs
- NotifyCollectionChangedEventArgs.cs
- BuildProviderAppliesToAttribute.cs
- DataService.cs
- DesignerVerb.cs
- XmlElementElement.cs
- FunctionCommandText.cs
- XmlSchemaAny.cs
- ServiceObjectContainer.cs
- VisualTreeUtils.cs
- AssertUtility.cs
- ContentIterators.cs
- Quaternion.cs
- EdmItemCollection.cs
- SerializerDescriptor.cs
- HtmlInputSubmit.cs
- BinaryObjectInfo.cs
- MasterPageCodeDomTreeGenerator.cs
- Oid.cs
- LambdaCompiler.Unary.cs
- GeneralTransform3D.cs
- SqlCharStream.cs
- NativeMethods.cs
- ColumnMapTranslator.cs
- TabControlAutomationPeer.cs
- Configuration.cs
- LogicalCallContext.cs
- XXXInfos.cs
- XamlReaderHelper.cs
- SettingsPropertyCollection.cs
- ActivityAction.cs
- DataBoundLiteralControl.cs
- WebBrowserNavigatedEventHandler.cs
- CapacityStreamGeometryContext.cs
- BitmapEffectInput.cs
- BamlLocalizer.cs
- ClientCredentials.cs
- GenericIdentity.cs
- ControlPropertyNameConverter.cs
- XPathNavigator.cs
- BasicHttpMessageSecurityElement.cs
- HierarchicalDataBoundControlAdapter.cs
- TraceSource.cs
- Margins.cs
- ConfigViewGenerator.cs
- SingleObjectCollection.cs
- _LazyAsyncResult.cs
- ComplexPropertyEntry.cs
- AppLevelCompilationSectionCache.cs
- _TransmitFileOverlappedAsyncResult.cs
- SystemColors.cs
- ImageUrlEditor.cs
- ApplicationSecurityInfo.cs
- WpfPayload.cs
- SqlFunctions.cs
- MetabaseReader.cs
- CodeParameterDeclarationExpressionCollection.cs
- WebBrowserSiteBase.cs
- securitycriticaldata.cs
- XmlMtomReader.cs
- NetworkInterface.cs
- MethodBody.cs
- ServiceRoute.cs
- HostVisual.cs
- SecurityDescriptor.cs
- TdsParserSessionPool.cs
- NativeStructs.cs
- WaitHandleCannotBeOpenedException.cs
- ButtonBase.cs
- UnsafeNativeMethods.cs
- Binding.cs
- DataGridViewBindingCompleteEventArgs.cs
- ManagedCodeMarkers.cs
- RequestCachePolicyConverter.cs
- CryptoStream.cs
- SafeMILHandle.cs
- Perspective.cs
- Point4DValueSerializer.cs
- XslNumber.cs
- SourceElementsCollection.cs
- Nodes.cs
- CallSiteBinder.cs
- DataGridViewCellConverter.cs
- StrongTypingException.cs
- InternalRelationshipCollection.cs
- cookieexception.cs
- CommandHelpers.cs
- MimeFormatExtensions.cs
- figurelength.cs
- HttpCookiesSection.cs
- xdrvalidator.cs
- EncodedStreamFactory.cs
- LifetimeManager.cs