Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / DropSource.cs / 1305376 / DropSource.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; /// internal class DropSource : UnsafeNativeMethods.IOleDropSource { private const int DragDropSDrop = 0x00040100; private const int DragDropSCancel = 0x00040101; private const int DragDropSUseDefaultCursors = 0x00040102; private ISupportOleDropSource peer; public DropSource(ISupportOleDropSource peer ) { if (peer == null) throw new ArgumentNullException("peer"); this.peer = peer; } public int OleQueryContinueDrag(int fEscapePressed, int grfKeyState) { QueryContinueDragEventArgs qcdevent = null; bool escapePressed = (fEscapePressed != 0); DragAction action = DragAction.Continue; if (escapePressed) { action = DragAction.Cancel; } else if ((grfKeyState & NativeMethods.MK_LBUTTON) == 0 && (grfKeyState & NativeMethods.MK_RBUTTON) == 0 && (grfKeyState & NativeMethods.MK_MBUTTON) == 0) { action = DragAction.Drop; } qcdevent = new QueryContinueDragEventArgs(grfKeyState,escapePressed, action); peer.OnQueryContinueDrag(qcdevent); int hr = 0; switch (qcdevent.Action) { case DragAction.Drop: hr = DragDropSDrop; break; case DragAction.Cancel: hr = DragDropSCancel; break; } return hr; } public int OleGiveFeedback(int dwEffect) { GiveFeedbackEventArgs gfbevent = new GiveFeedbackEventArgs((DragDropEffects) dwEffect, true); peer.OnGiveFeedback(gfbevent); if (gfbevent.UseDefaultCursors) { return DragDropSUseDefaultCursors; } return 0; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; /// internal class DropSource : UnsafeNativeMethods.IOleDropSource { private const int DragDropSDrop = 0x00040100; private const int DragDropSCancel = 0x00040101; private const int DragDropSUseDefaultCursors = 0x00040102; private ISupportOleDropSource peer; public DropSource(ISupportOleDropSource peer ) { if (peer == null) throw new ArgumentNullException("peer"); this.peer = peer; } public int OleQueryContinueDrag(int fEscapePressed, int grfKeyState) { QueryContinueDragEventArgs qcdevent = null; bool escapePressed = (fEscapePressed != 0); DragAction action = DragAction.Continue; if (escapePressed) { action = DragAction.Cancel; } else if ((grfKeyState & NativeMethods.MK_LBUTTON) == 0 && (grfKeyState & NativeMethods.MK_RBUTTON) == 0 && (grfKeyState & NativeMethods.MK_MBUTTON) == 0) { action = DragAction.Drop; } qcdevent = new QueryContinueDragEventArgs(grfKeyState,escapePressed, action); peer.OnQueryContinueDrag(qcdevent); int hr = 0; switch (qcdevent.Action) { case DragAction.Drop: hr = DragDropSDrop; break; case DragAction.Cancel: hr = DragDropSCancel; break; } return hr; } public int OleGiveFeedback(int dwEffect) { GiveFeedbackEventArgs gfbevent = new GiveFeedbackEventArgs((DragDropEffects) dwEffect, true); peer.OnGiveFeedback(gfbevent); if (gfbevent.UseDefaultCursors) { return DragDropSUseDefaultCursors; } return 0; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DragCompletedEventArgs.cs
- XmlLanguageConverter.cs
- AsymmetricKeyExchangeFormatter.cs
- LayoutTableCell.cs
- MenuItemStyleCollection.cs
- VectorAnimation.cs
- XmlCharacterData.cs
- DataSourceControlBuilder.cs
- LinkUtilities.cs
- BitmapEffectGroup.cs
- COM2ColorConverter.cs
- VisualStyleTypesAndProperties.cs
- NotFiniteNumberException.cs
- MimePart.cs
- ShutDownListener.cs
- CombinedGeometry.cs
- TextBoxAutomationPeer.cs
- ExternalCalls.cs
- IntegrationExceptionEventArgs.cs
- IncomingWebResponseContext.cs
- TraceInternal.cs
- WebConfigManager.cs
- EncryptedPackageFilter.cs
- SmiRecordBuffer.cs
- DebugHandleTracker.cs
- FunctionQuery.cs
- BatchParser.cs
- OleDbConnection.cs
- StructuralType.cs
- SettingsBindableAttribute.cs
- IIS7UserPrincipal.cs
- HttpModuleActionCollection.cs
- WebServicesInteroperability.cs
- SubpageParagraph.cs
- DBCommandBuilder.cs
- WebBaseEventKeyComparer.cs
- Operator.cs
- PackageRelationshipSelector.cs
- SoapReflectionImporter.cs
- ImageFormat.cs
- StorageComplexTypeMapping.cs
- OleDbParameter.cs
- RegexCapture.cs
- Debugger.cs
- RuntimeHandles.cs
- AsymmetricKeyExchangeDeformatter.cs
- XmlChoiceIdentifierAttribute.cs
- MonitorWrapper.cs
- DrawingGroupDrawingContext.cs
- KeyEvent.cs
- KeyInstance.cs
- printdlgexmarshaler.cs
- EnvelopedSignatureTransform.cs
- BitmapEffectGroup.cs
- TaskFileService.cs
- ResourceSet.cs
- TextModifierScope.cs
- SqlUserDefinedTypeAttribute.cs
- AssociationTypeEmitter.cs
- DropSource.cs
- ResourceDisplayNameAttribute.cs
- DelayLoadType.cs
- IntPtr.cs
- ProfileSettings.cs
- NetworkInterface.cs
- EarlyBoundInfo.cs
- TextElementEditingBehaviorAttribute.cs
- BaseDataBoundControl.cs
- OrderedDictionary.cs
- SoapServerMethod.cs
- XamlToRtfWriter.cs
- CheckBoxBaseAdapter.cs
- odbcmetadatacolumnnames.cs
- CTreeGenerator.cs
- XamlSerializer.cs
- DeferredSelectedIndexReference.cs
- XmlSchemaSimpleTypeList.cs
- QilNode.cs
- GPRECTF.cs
- X509RecipientCertificateServiceElement.cs
- SqlNotificationRequest.cs
- InkSerializer.cs
- WorkflowMarkupSerializationProvider.cs
- RenderingEventArgs.cs
- ReliabilityContractAttribute.cs
- WebPartHeaderCloseVerb.cs
- UseAttributeSetsAction.cs
- WebPartManagerInternals.cs
- NativeMethods.cs
- CodeStatement.cs
- RightsManagementProvider.cs
- SiteMembershipCondition.cs
- PackageFilter.cs
- webclient.cs
- MissingMemberException.cs
- DeploymentExceptionMapper.cs
- Vector3DKeyFrameCollection.cs
- SortDescriptionCollection.cs
- CodeExpressionCollection.cs
- WindowsAuthenticationEventArgs.cs