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
- Stylus.cs
- StringUtil.cs
- EntityUtil.cs
- ContextMenuStrip.cs
- WorkflowWebService.cs
- WebDescriptionAttribute.cs
- AutomationPattern.cs
- HashMembershipCondition.cs
- CodeLabeledStatement.cs
- TreeNodeBindingCollection.cs
- ClientRequest.cs
- WindowsSpinner.cs
- HostProtectionPermission.cs
- ActivityExecutorDelegateInfo.cs
- FirewallWrapper.cs
- SQLResource.cs
- XmlSchemaSubstitutionGroup.cs
- columnmapkeybuilder.cs
- Opcode.cs
- MethodImplAttribute.cs
- TextServicesLoader.cs
- ModuleElement.cs
- RuntimeEnvironment.cs
- ClrPerspective.cs
- LocalIdKeyIdentifierClause.cs
- ConstructorExpr.cs
- AsyncResult.cs
- EntityDataReader.cs
- ExpressionBindings.cs
- ObjectDataSourceFilteringEventArgs.cs
- DataError.cs
- ResXResourceSet.cs
- GenericNameHandler.cs
- Expr.cs
- MemoryRecordBuffer.cs
- XmlSerializerNamespaces.cs
- InputProcessorProfilesLoader.cs
- NullReferenceException.cs
- SessionState.cs
- LogReserveAndAppendState.cs
- ToolStripLabel.cs
- CrossContextChannel.cs
- Panel.cs
- WebRequestModulesSection.cs
- PersonalizationAdministration.cs
- DeploymentSectionCache.cs
- ParseHttpDate.cs
- SpellCheck.cs
- IsolatedStoragePermission.cs
- WebBrowserEvent.cs
- HashMembershipCondition.cs
- ResourceExpressionBuilder.cs
- CollectionEditorDialog.cs
- FrameworkElementAutomationPeer.cs
- SqlParameter.cs
- HttpServerVarsCollection.cs
- itemelement.cs
- ZoneIdentityPermission.cs
- CngKeyBlobFormat.cs
- FloaterParagraph.cs
- BinaryReader.cs
- DiagnosticsConfigurationHandler.cs
- TypeInitializationException.cs
- PolicyLevel.cs
- DataGrid.cs
- ContextStack.cs
- SRDisplayNameAttribute.cs
- SqlRemoveConstantOrderBy.cs
- WebPartHeaderCloseVerb.cs
- DateTimeSerializationSection.cs
- MethodToken.cs
- UIElement3D.cs
- Number.cs
- PackageDigitalSignature.cs
- Menu.cs
- FontWeightConverter.cs
- InstanceData.cs
- RectangleHotSpot.cs
- CommandBinding.cs
- RunInstallerAttribute.cs
- FrameworkElementFactory.cs
- Int16.cs
- UnicodeEncoding.cs
- DetailsView.cs
- SelectorAutomationPeer.cs
- columnmapfactory.cs
- LinqDataSourceHelper.cs
- DivideByZeroException.cs
- XmlUrlResolver.cs
- NetworkCredential.cs
- XmlBinaryReader.cs
- ScriptComponentDescriptor.cs
- ReadOnlyPropertyMetadata.cs
- listviewsubitemcollectioneditor.cs
- TrustManager.cs
- XmlQualifiedName.cs
- TokenBasedSetEnumerator.cs
- WindowsUpDown.cs
- SpellerHighlightLayer.cs
- DbTransaction.cs