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
- XmlEntityReference.cs
- LeafCellTreeNode.cs
- MasterPageBuildProvider.cs
- Update.cs
- VirtualizedItemProviderWrapper.cs
- ToolStripItemEventArgs.cs
- DataPagerFieldCollection.cs
- PageWrapper.cs
- HandlerBase.cs
- Int32KeyFrameCollection.cs
- XhtmlBasicLabelAdapter.cs
- TransactionOptions.cs
- EntityKey.cs
- safesecurityhelperavalon.cs
- SapiRecoContext.cs
- ComEventsMethod.cs
- FileLogRecordStream.cs
- Token.cs
- PersonalizationAdministration.cs
- ProfilePropertyNameValidator.cs
- Comparer.cs
- ScrollEvent.cs
- SafeProcessHandle.cs
- MessageAction.cs
- GroupLabel.cs
- EventWaitHandleSecurity.cs
- PathSegmentCollection.cs
- PipelineComponent.cs
- CatalogZoneBase.cs
- PersonalizableAttribute.cs
- StyleTypedPropertyAttribute.cs
- MorphHelper.cs
- TimeoutException.cs
- BrowserCapabilitiesFactory.cs
- PageCatalogPart.cs
- BindingExpression.cs
- CompareInfo.cs
- COM2ExtendedUITypeEditor.cs
- AudioFormatConverter.cs
- Adorner.cs
- CustomErrorCollection.cs
- SoapSchemaExporter.cs
- QilLiteral.cs
- CompleteWizardStep.cs
- _DigestClient.cs
- RectAnimation.cs
- UInt16.cs
- ProcessModelSection.cs
- HitTestDrawingContextWalker.cs
- WindowsListViewGroupHelper.cs
- TypeValidationEventArgs.cs
- CodeTypeDelegate.cs
- AttachedPropertyBrowsableAttribute.cs
- DesignerVerb.cs
- LowerCaseStringConverter.cs
- SplitContainerDesigner.cs
- DiffuseMaterial.cs
- CompilerGeneratedAttribute.cs
- FormsAuthenticationEventArgs.cs
- EnumCodeDomSerializer.cs
- InputReport.cs
- DiagnosticsConfiguration.cs
- SingleConverter.cs
- SqlResolver.cs
- InternalConfigEventArgs.cs
- CodeLabeledStatement.cs
- XmlMapping.cs
- ScriptControlManager.cs
- Brush.cs
- CngKey.cs
- TypeExtension.cs
- KerberosSecurityTokenAuthenticator.cs
- Transform.cs
- ResourceDefaultValueAttribute.cs
- XslVisitor.cs
- VirtualDirectoryMappingCollection.cs
- DeploymentSection.cs
- CryptographicAttribute.cs
- SymLanguageType.cs
- WorkflowServiceOperationListItem.cs
- ReaderOutput.cs
- StatusBarItem.cs
- Crc32Helper.cs
- BindUriHelper.cs
- ServiceX509SecurityTokenProvider.cs
- View.cs
- AuthenticationServiceManager.cs
- DetailsViewCommandEventArgs.cs
- TimeEnumHelper.cs
- CachedResourceDictionaryExtension.cs
- ToolStripRenderer.cs
- WebPartHeaderCloseVerb.cs
- PageStatePersister.cs
- MenuStrip.cs
- BaseCollection.cs
- ImageCodecInfo.cs
- IFlowDocumentViewer.cs
- EncoderExceptionFallback.cs
- ChildTable.cs
- DictionaryGlobals.cs