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
- Assert.cs
- RegistrySecurity.cs
- WebServiceHandlerFactory.cs
- Stylus.cs
- TypeSystem.cs
- DispatcherObject.cs
- WebBrowserPermission.cs
- ToolStripItemTextRenderEventArgs.cs
- RightsManagementProvider.cs
- CheckoutException.cs
- TextServicesManager.cs
- DelayedRegex.cs
- DesignerUtility.cs
- BaseValidator.cs
- DesignColumn.cs
- ByteRangeDownloader.cs
- ConfigurationManagerHelper.cs
- NetPeerTcpBindingElement.cs
- MergeFailedEvent.cs
- FixedTextBuilder.cs
- EntityDataSourceWizardForm.cs
- Image.cs
- NameValueConfigurationCollection.cs
- CodeCompileUnit.cs
- SerialPinChanges.cs
- EntityContainerEntitySet.cs
- StrongNameUtility.cs
- CallbackHandler.cs
- HelpFileFileNameEditor.cs
- ObjectViewEntityCollectionData.cs
- JumpList.cs
- SqlDependencyListener.cs
- EmbeddedObject.cs
- NavigatingCancelEventArgs.cs
- DesignerCategoryAttribute.cs
- VectorConverter.cs
- HwndMouseInputProvider.cs
- Operand.cs
- StatusCommandUI.cs
- RangeValuePattern.cs
- EDesignUtil.cs
- RegistrationServices.cs
- CommandValueSerializer.cs
- DragDeltaEventArgs.cs
- ArglessEventHandlerProxy.cs
- XPathDocumentIterator.cs
- FrameworkContextData.cs
- ColorConvertedBitmap.cs
- HtmlCalendarAdapter.cs
- Binding.cs
- KnowledgeBase.cs
- StringDictionary.cs
- ContractComponent.cs
- CallbackHandler.cs
- StylusPointPropertyInfo.cs
- TranslateTransform.cs
- PagesSection.cs
- PaginationProgressEventArgs.cs
- PageCatalogPart.cs
- StatusBarItem.cs
- WindowInteropHelper.cs
- HtmlWindow.cs
- HttpHandlerAction.cs
- SqlDataSourceCache.cs
- DispatchWrapper.cs
- SimpleWorkerRequest.cs
- FileController.cs
- ApplicationProxyInternal.cs
- ParameterElementCollection.cs
- SecurityException.cs
- ToolStripPanel.cs
- ADMembershipProvider.cs
- ExceptionHandlerDesigner.cs
- CodeTypeParameter.cs
- SafeEventLogWriteHandle.cs
- SimpleWorkerRequest.cs
- WorkflowOperationAsyncResult.cs
- AssemblyName.cs
- CodeTypeParameterCollection.cs
- HttpGetClientProtocol.cs
- MainMenu.cs
- DataObject.cs
- BezierSegment.cs
- SatelliteContractVersionAttribute.cs
- MetadataPropertyCollection.cs
- DataGridViewCellEventArgs.cs
- UnrecognizedPolicyAssertionElement.cs
- WebServiceErrorEvent.cs
- coordinatorscratchpad.cs
- TraceRecord.cs
- BitmapImage.cs
- GroupAggregateExpr.cs
- RegisteredScript.cs
- PopupEventArgs.cs
- HttpProxyTransportBindingElement.cs
- RichListBox.cs
- SettingsPropertyValue.cs
- WebMessageEncoderFactory.cs
- COM2ExtendedTypeConverter.cs
- DirtyTextRange.cs