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
- GlobalizationAssembly.cs
- ProtocolViolationException.cs
- AnnotationMap.cs
- StateMachineDesignerPaint.cs
- SapiInterop.cs
- PathSegment.cs
- columnmapkeybuilder.cs
- FontUnit.cs
- CompositeDuplexBindingElement.cs
- RectAnimationUsingKeyFrames.cs
- CatalogPart.cs
- Executor.cs
- XamlReaderHelper.cs
- DataObjectEventArgs.cs
- DbCommandTree.cs
- FormsAuthenticationEventArgs.cs
- HwndSource.cs
- XPathEmptyIterator.cs
- TableLayout.cs
- XmlCodeExporter.cs
- ChildrenQuery.cs
- DataSpaceManager.cs
- VScrollBar.cs
- WindowsHyperlink.cs
- templategroup.cs
- SqlDataSourceFilteringEventArgs.cs
- FileRecordSequenceCompletedAsyncResult.cs
- PropertyEmitter.cs
- VerifyHashRequest.cs
- ExtensibleClassFactory.cs
- FixedDocumentSequencePaginator.cs
- DataGridView.cs
- AspNetSynchronizationContext.cs
- EdmComplexPropertyAttribute.cs
- SchemaImporter.cs
- PropertyValueUIItem.cs
- BaseTemplateBuildProvider.cs
- UInt32Converter.cs
- EmbossBitmapEffect.cs
- ProjectionPruner.cs
- ConfigXmlDocument.cs
- StyleReferenceConverter.cs
- CopyCodeAction.cs
- EpmSyndicationContentDeSerializer.cs
- DataServiceQueryOfT.cs
- IncrementalCompileAnalyzer.cs
- SiteMapSection.cs
- UnsafePeerToPeerMethods.cs
- WindowsClaimSet.cs
- Win32Exception.cs
- TemplateColumn.cs
- MetadataWorkspace.cs
- IODescriptionAttribute.cs
- IDReferencePropertyAttribute.cs
- Wizard.cs
- EventListener.cs
- WebPartCollection.cs
- PersistenceParticipant.cs
- ProfileSettingsCollection.cs
- InputReportEventArgs.cs
- ShaperBuffers.cs
- CssTextWriter.cs
- IdentitySection.cs
- InternalConfigRoot.cs
- LinkedResource.cs
- GroupBoxAutomationPeer.cs
- TCPClient.cs
- PageThemeBuildProvider.cs
- StyleSelector.cs
- Util.cs
- ExtractorMetadata.cs
- ManagementBaseObject.cs
- Profiler.cs
- SqlCommand.cs
- ContentElementAutomationPeer.cs
- HashHelper.cs
- GeneralTransform3DGroup.cs
- SortDescription.cs
- CodeMemberEvent.cs
- EventDescriptor.cs
- SqlDataSourceQueryEditorForm.cs
- Error.cs
- OneOfScalarConst.cs
- ICollection.cs
- DataGridCheckBoxColumn.cs
- CompiledIdentityConstraint.cs
- Point.cs
- sqlstateclientmanager.cs
- TextServicesCompartment.cs
- HtmlElementEventArgs.cs
- XmlILIndex.cs
- TdsParserHelperClasses.cs
- SQLChars.cs
- JsonServiceDocumentSerializer.cs
- WebAdminConfigurationHelper.cs
- WebBrowserHelper.cs
- Thread.cs
- DiagnosticStrings.cs
- sqlstateclientmanager.cs
- EncryptedKey.cs