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
- TransactionBridgeSection.cs
- HandleCollector.cs
- XPathNodeList.cs
- IPPacketInformation.cs
- PartialList.cs
- SelectionProcessor.cs
- FamilyMap.cs
- Event.cs
- XmlToDatasetMap.cs
- NetSectionGroup.cs
- BidOverLoads.cs
- GradientBrush.cs
- SystemIcmpV6Statistics.cs
- Hashtable.cs
- WebResourceAttribute.cs
- TextShapeableCharacters.cs
- ValidationPropertyAttribute.cs
- FolderBrowserDialog.cs
- StateItem.cs
- DrawItemEvent.cs
- AtomMaterializer.cs
- FieldToken.cs
- DynamicMethod.cs
- SyncOperationState.cs
- AppDomainFactory.cs
- TraceLog.cs
- DataColumnChangeEvent.cs
- ItemList.cs
- SqlCommandBuilder.cs
- BamlTreeMap.cs
- Accessors.cs
- ExpandedWrapper.cs
- XmlResolver.cs
- safelinkcollection.cs
- PartialArray.cs
- RtfToken.cs
- CrossSiteScriptingValidation.cs
- SEHException.cs
- OperationBehaviorAttribute.cs
- MenuItemBindingCollection.cs
- ASCIIEncoding.cs
- ThicknessAnimationUsingKeyFrames.cs
- AsyncWaitHandle.cs
- SQLInt64Storage.cs
- DoubleAnimationUsingPath.cs
- StopStoryboard.cs
- latinshape.cs
- FastPropertyAccessor.cs
- XslAstAnalyzer.cs
- DbParameterHelper.cs
- InstanceCreationEditor.cs
- CommandConverter.cs
- SynchronizedDispatch.cs
- BindingContext.cs
- ImageKeyConverter.cs
- _ProxyRegBlob.cs
- ReadingWritingEntityEventArgs.cs
- DataTableExtensions.cs
- CommonXSendMessage.cs
- SourceLineInfo.cs
- mongolianshape.cs
- TrackBar.cs
- SourceLocation.cs
- DataSourceDesigner.cs
- InfoCardTraceRecord.cs
- CodePropertyReferenceExpression.cs
- LeftCellWrapper.cs
- TableRowCollection.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- SHA512CryptoServiceProvider.cs
- WinEventWrap.cs
- HitTestParameters.cs
- PropertyValueUIItem.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- ObjectNavigationPropertyMapping.cs
- Int64Animation.cs
- ClickablePoint.cs
- EpmContentDeSerializer.cs
- WindowPattern.cs
- ValueTypeFixupInfo.cs
- IssuedTokenClientBehaviorsElement.cs
- HttpPostedFile.cs
- PropertyContainer.cs
- ViewKeyConstraint.cs
- ConfigurationException.cs
- MD5CryptoServiceProvider.cs
- COAUTHIDENTITY.cs
- Expression.cs
- StreamGeometry.cs
- PasswordTextNavigator.cs
- Graph.cs
- Compensate.cs
- RpcCryptoContext.cs
- IPEndPointCollection.cs
- HtmlDocument.cs
- DbExpressionVisitor_TResultType.cs
- ObjectKeyFrameCollection.cs
- PersonalizationStateInfo.cs
- UIElementIsland.cs
- MaskedTextProvider.cs