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
- ResXDataNode.cs
- BindingCompleteEventArgs.cs
- PopOutPanel.cs
- StructuredTypeEmitter.cs
- NegatedCellConstant.cs
- MeasureData.cs
- JsonDeserializer.cs
- EventEntry.cs
- DataBinding.cs
- StringResourceManager.cs
- HiddenFieldPageStatePersister.cs
- IArgumentProvider.cs
- SQLByte.cs
- MediaPlayer.cs
- InvalidPropValue.cs
- Int32Storage.cs
- WpfXamlLoader.cs
- MouseEventArgs.cs
- DataGridItem.cs
- Control.cs
- PropertyEntry.cs
- AssemblyAttributesGoHere.cs
- QueryInterceptorAttribute.cs
- Pair.cs
- OrCondition.cs
- ParameterCollection.cs
- OleDbParameterCollection.cs
- DisplayInformation.cs
- DataGridViewTextBoxEditingControl.cs
- TextEffectCollection.cs
- EllipseGeometry.cs
- SynchronizationLockException.cs
- CodePrimitiveExpression.cs
- PopupRootAutomationPeer.cs
- SQLInt64.cs
- invalidudtexception.cs
- DataTableMappingCollection.cs
- ClientUrlResolverWrapper.cs
- TraceLog.cs
- StyleSelector.cs
- ContentPlaceHolder.cs
- PagesChangedEventArgs.cs
- CopyNodeSetAction.cs
- ActivityCodeDomSerializer.cs
- CapabilitiesState.cs
- ResXBuildProvider.cs
- SocketException.cs
- Assembly.cs
- StringValueConverter.cs
- ContextMenu.cs
- EntityClassGenerator.cs
- PopupControlService.cs
- RadialGradientBrush.cs
- SqlClientMetaDataCollectionNames.cs
- AttributeCollection.cs
- ToolStripSystemRenderer.cs
- ToolBarButtonDesigner.cs
- DataQuery.cs
- DataServices.cs
- DataGridViewComboBoxCell.cs
- DefaultIfEmptyQueryOperator.cs
- TitleStyle.cs
- PagesChangedEventArgs.cs
- odbcmetadatacollectionnames.cs
- SqlTriggerContext.cs
- _WebProxyDataBuilder.cs
- CreateRefExpr.cs
- StylusEventArgs.cs
- Invariant.cs
- NavigationWindowAutomationPeer.cs
- WebServiceMethodData.cs
- DataGridViewTopLeftHeaderCell.cs
- NetworkCredential.cs
- XhtmlBasicLinkAdapter.cs
- TextEmbeddedObject.cs
- EdmSchemaError.cs
- TraceSwitch.cs
- HttpListenerContext.cs
- IQueryable.cs
- XmlSchemaAnyAttribute.cs
- HighlightVisual.cs
- RequestCache.cs
- CaretElement.cs
- PersistenceTypeAttribute.cs
- MessageTraceRecord.cs
- OutputCacheSection.cs
- ImageBrush.cs
- NativeMethods.cs
- GlyphRunDrawing.cs
- MenuTracker.cs
- ProcessManager.cs
- CriticalExceptions.cs
- MetafileHeaderWmf.cs
- DependencyPropertyValueSerializer.cs
- ChangeConflicts.cs
- XmlSchemaException.cs
- SHA384.cs
- DiscriminatorMap.cs
- ApplicationContext.cs
- PeerNameResolver.cs