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
- Stopwatch.cs
- WrappingXamlSchemaContext.cs
- sqlser.cs
- MatrixTransform3D.cs
- SplashScreen.cs
- LinkLabelLinkClickedEvent.cs
- SecurityTokenTypes.cs
- ElementHostAutomationPeer.cs
- SystemFonts.cs
- IPCCacheManager.cs
- RegisteredHiddenField.cs
- SystemResourceHost.cs
- TypedElement.cs
- DefaultParameterValueAttribute.cs
- SymmetricKeyWrap.cs
- DeflateInput.cs
- BinaryFormatter.cs
- TemplateInstanceAttribute.cs
- TimeSpanValidator.cs
- ProfileModule.cs
- HttpCapabilitiesBase.cs
- SchemaNotation.cs
- ObjectAssociationEndMapping.cs
- StringConverter.cs
- PolicyException.cs
- TreeChangeInfo.cs
- FilterEventArgs.cs
- ObjectFullSpanRewriter.cs
- GraphicsContext.cs
- Button.cs
- ControlCachePolicy.cs
- WorkflowInstance.cs
- ASCIIEncoding.cs
- CreatingCookieEventArgs.cs
- CellQuery.cs
- StringConcat.cs
- SiteMapDataSource.cs
- XXXInfos.cs
- _HeaderInfoTable.cs
- SymbolPair.cs
- ReferencedAssembly.cs
- ProgressChangedEventArgs.cs
- DataGridHelper.cs
- SymmetricSecurityProtocolFactory.cs
- AuthenticationModuleElementCollection.cs
- unitconverter.cs
- TreeNodeCollectionEditor.cs
- ConnectionManagementElement.cs
- VisualBrush.cs
- Odbc32.cs
- State.cs
- XomlDesignerLoader.cs
- OleDbWrapper.cs
- DataKey.cs
- Label.cs
- BindingValueChangedEventArgs.cs
- GroupBoxRenderer.cs
- InputQueue.cs
- UmAlQuraCalendar.cs
- ExceptionUtil.cs
- CodeVariableDeclarationStatement.cs
- TextBoxAutomationPeer.cs
- FixedHyperLink.cs
- ControlBuilder.cs
- HtmlTableRowCollection.cs
- Int64AnimationBase.cs
- XamlDesignerSerializationManager.cs
- DSACryptoServiceProvider.cs
- StrongNameUtility.cs
- OrderByBuilder.cs
- IPAddressCollection.cs
- HeaderedContentControl.cs
- BaseUriHelper.cs
- ColorBlend.cs
- ScrollItemPatternIdentifiers.cs
- ObjectListItemCollection.cs
- C14NUtil.cs
- TypeUnloadedException.cs
- _TransmitFileOverlappedAsyncResult.cs
- DbDataSourceEnumerator.cs
- SchemaImporter.cs
- ConnectionStringSettings.cs
- StorageAssociationSetMapping.cs
- PropertiesTab.cs
- SessionParameter.cs
- SqlCommand.cs
- ApplicationSettingsBase.cs
- HttpModuleAction.cs
- DataGridViewComboBoxColumn.cs
- DuplexClientBase.cs
- FrameworkObject.cs
- HeaderElement.cs
- WebPartConnectionCollection.cs
- SmiContextFactory.cs
- EntityTransaction.cs
- StringValueSerializer.cs
- DiscoveryEndpointValidator.cs
- ActivityBuilderHelper.cs
- FontSizeConverter.cs
- DataGridViewCellMouseEventArgs.cs