Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / WinForms / Managed / System / WinForms / DropSource.cs / 1 / 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
- XmlSchemaAnnotation.cs
- SiteMapNodeCollection.cs
- TemplateControlCodeDomTreeGenerator.cs
- TrustManagerPromptUI.cs
- MailBnfHelper.cs
- SerializationInfoEnumerator.cs
- SplitterCancelEvent.cs
- FeatureSupport.cs
- EventData.cs
- TextEncodedRawTextWriter.cs
- MenuScrollingVisibilityConverter.cs
- DataGridViewRowCollection.cs
- NetworkInterface.cs
- XmlNodeList.cs
- Vector3DConverter.cs
- DynamicEndpointElement.cs
- oledbmetadatacollectionnames.cs
- Visitor.cs
- PrintPreviewGraphics.cs
- AppPool.cs
- PartManifestEntry.cs
- ControlBuilder.cs
- LabelDesigner.cs
- MutexSecurity.cs
- MenuItem.cs
- GeneralTransform3D.cs
- IntSecurity.cs
- TypeBuilderInstantiation.cs
- DataServiceSaveChangesEventArgs.cs
- ExpressionBuilderContext.cs
- unsafenativemethodstextservices.cs
- ChildrenQuery.cs
- HybridDictionary.cs
- StaticContext.cs
- DataGridTextBox.cs
- HttpListenerPrefixCollection.cs
- RequestQueue.cs
- TypeUnloadedException.cs
- KeyValueConfigurationCollection.cs
- ObjectManager.cs
- HttpEncoderUtility.cs
- GrammarBuilderRuleRef.cs
- XamlStackWriter.cs
- TableCellAutomationPeer.cs
- CertificateReferenceElement.cs
- NativeMethods.cs
- coordinatorscratchpad.cs
- ObjectNotFoundException.cs
- TransactionValidationBehavior.cs
- DBDataPermission.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- BaseCAMarshaler.cs
- ConnectivityStatus.cs
- ProtocolsSection.cs
- XmlSignatureManifest.cs
- GeometryCollection.cs
- MenuEventArgs.cs
- _LocalDataStoreMgr.cs
- ComponentCodeDomSerializer.cs
- RuleSetDialog.cs
- SpeechSeg.cs
- ManifestResourceInfo.cs
- XPathDocument.cs
- FunctionParameter.cs
- Set.cs
- Preprocessor.cs
- VectorKeyFrameCollection.cs
- DaylightTime.cs
- DragStartedEventArgs.cs
- JavaScriptObjectDeserializer.cs
- HashMembershipCondition.cs
- EFAssociationProvider.cs
- DataSourceCacheDurationConverter.cs
- InfoCardConstants.cs
- MethodBody.cs
- CheckBoxList.cs
- X509CertificateCollection.cs
- HTMLTextWriter.cs
- XmlObjectSerializerWriteContextComplex.cs
- PanelDesigner.cs
- DbQueryCommandTree.cs
- QilFunction.cs
- BaseUriHelper.cs
- COAUTHINFO.cs
- AttachedAnnotationChangedEventArgs.cs
- TemplateBuilder.cs
- EntityDataSourceStatementEditorForm.cs
- HttpPostedFileBase.cs
- DataBindingValueUIHandler.cs
- SQLDecimalStorage.cs
- StructuralType.cs
- SelectingProviderEventArgs.cs
- SmtpSection.cs
- X509SecurityTokenParameters.cs
- XmlCharType.cs
- Select.cs
- indexingfiltermarshaler.cs
- SerializationAttributes.cs
- EventData.cs
- SeverityFilter.cs