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
- JsonSerializer.cs
- XamlParser.cs
- ExpressionBuilder.cs
- contentDescriptor.cs
- DataGridViewImageCell.cs
- WpfKnownTypeInvoker.cs
- TextSimpleMarkerProperties.cs
- XmlStreamStore.cs
- AppSettingsReader.cs
- WindowsRegion.cs
- EventLogPropertySelector.cs
- WebServiceData.cs
- TypeSystemProvider.cs
- RequestCachePolicyConverter.cs
- PrePrepareMethodAttribute.cs
- InternalTypeHelper.cs
- ConversionHelper.cs
- DataRowExtensions.cs
- SimpleExpression.cs
- MailWriter.cs
- UrlSyndicationContent.cs
- DataGridViewColumnConverter.cs
- cache.cs
- Convert.cs
- DataGridViewRowEventArgs.cs
- AsyncOperation.cs
- DefaultObjectMappingItemCollection.cs
- PriorityChain.cs
- DataBoundControl.cs
- SQLBinaryStorage.cs
- ParserContext.cs
- PageAdapter.cs
- UnsafeNativeMethodsTablet.cs
- TrustLevelCollection.cs
- HttpRuntime.cs
- Thickness.cs
- UnsafeNativeMethods.cs
- FilterableAttribute.cs
- Walker.cs
- ToolStripRendererSwitcher.cs
- WebRequestModuleElement.cs
- BitmapVisualManager.cs
- TextCompositionEventArgs.cs
- Exception.cs
- SecurityUniqueId.cs
- PrintPreviewDialog.cs
- ColumnPropertiesGroup.cs
- RemotingSurrogateSelector.cs
- TextFragmentEngine.cs
- UITypeEditors.cs
- ContractInferenceHelper.cs
- URI.cs
- linebase.cs
- PropertySourceInfo.cs
- SerializerDescriptor.cs
- OptimalBreakSession.cs
- ObjectSpanRewriter.cs
- DiffuseMaterial.cs
- SpAudioStreamWrapper.cs
- BindingExpressionBase.cs
- EpmCustomContentSerializer.cs
- invalidudtexception.cs
- GridErrorDlg.cs
- XmlCharType.cs
- StreamGeometryContext.cs
- StringValueConverter.cs
- FileNotFoundException.cs
- SecurityAccessDeniedException.cs
- Symbol.cs
- DataGridCellAutomationPeer.cs
- BmpBitmapEncoder.cs
- MediaElement.cs
- AggregateException.cs
- SqlDataSourceStatusEventArgs.cs
- RouteParser.cs
- WebPartMenuStyle.cs
- XmlSchemaSimpleContent.cs
- ScriptingWebServicesSectionGroup.cs
- ClassicBorderDecorator.cs
- DataGridRow.cs
- IntegerFacetDescriptionElement.cs
- CodeCompiler.cs
- ObjRef.cs
- HtmlMeta.cs
- Decimal.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- MobileUserControl.cs
- SafeNativeMethods.cs
- FixedBufferAttribute.cs
- Icon.cs
- HotSpot.cs
- Assert.cs
- _NegoStream.cs
- ReachPrintTicketSerializerAsync.cs
- RequestSecurityToken.cs
- DependencyPropertyConverter.cs
- SerializerDescriptor.cs
- Pointer.cs
- DebuggerAttributes.cs
- Container.cs