Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ReachObjectContext.cs
- BitmapFrameDecode.cs
- CompilationUtil.cs
- AuthorizationContext.cs
- ToolStripSeparator.cs
- ListParagraph.cs
- ReadOnlyDictionary.cs
- AppSettingsSection.cs
- MetadataArtifactLoader.cs
- DataPagerCommandEventArgs.cs
- _LocalDataStore.cs
- HasCopySemanticsAttribute.cs
- TimerEventSubscription.cs
- KeyGestureConverter.cs
- ToolStripInSituService.cs
- DynamicRendererThreadManager.cs
- unsafenativemethodstextservices.cs
- HideDisabledControlAdapter.cs
- SerialReceived.cs
- Application.cs
- AuthenticationService.cs
- ExecutionTracker.cs
- SerialPort.cs
- Fault.cs
- CompositeControl.cs
- TextDpi.cs
- Logging.cs
- ArgumentsParser.cs
- ADConnectionHelper.cs
- RelationshipEndMember.cs
- PointHitTestParameters.cs
- GZipStream.cs
- SelectionItemPatternIdentifiers.cs
- DbModificationClause.cs
- LongValidatorAttribute.cs
- HitTestWithGeometryDrawingContextWalker.cs
- WebPartManager.cs
- ManagementObjectSearcher.cs
- RawUIStateInputReport.cs
- listviewsubitemcollectioneditor.cs
- HttpCacheParams.cs
- TraversalRequest.cs
- JoinCqlBlock.cs
- ThreadLocal.cs
- OuterGlowBitmapEffect.cs
- AutomationIdentifierGuids.cs
- TableSectionStyle.cs
- RegexMatch.cs
- ImportContext.cs
- EditModeSwitchButton.cs
- CaseCqlBlock.cs
- InertiaTranslationBehavior.cs
- DataGridPageChangedEventArgs.cs
- KeyTimeConverter.cs
- safemediahandle.cs
- ImageUrlEditor.cs
- Vector3DCollectionConverter.cs
- TextDecorationCollection.cs
- MsmqProcessProtocolHandler.cs
- AsyncPostBackTrigger.cs
- CDSsyncETWBCLProvider.cs
- HttpGetProtocolImporter.cs
- PersistenceProviderDirectory.cs
- BmpBitmapEncoder.cs
- TypeBuilder.cs
- UserControl.cs
- ProfileGroupSettingsCollection.cs
- PageCodeDomTreeGenerator.cs
- AmbientValueAttribute.cs
- WindowsPrincipal.cs
- RectAnimationBase.cs
- DataGridViewImageCell.cs
- TextRange.cs
- DrawingBrush.cs
- DirectoryNotFoundException.cs
- Int64Animation.cs
- NotificationContext.cs
- AssemblyFilter.cs
- DelayLoadType.cs
- FirstMatchCodeGroup.cs
- ZipIOExtraFieldElement.cs
- Expr.cs
- ProjectionCamera.cs
- LongValidatorAttribute.cs
- SizeF.cs
- PropertyGridView.cs
- SingleSelectRootGridEntry.cs
- CryptoHelper.cs
- IxmlLineInfo.cs
- PagerStyle.cs
- BooleanProjectedSlot.cs
- Table.cs
- ByteKeyFrameCollection.cs
- WorkerRequest.cs
- BitmapEffectState.cs
- ReachIDocumentPaginatorSerializerAsync.cs
- SoapIncludeAttribute.cs
- DependencyPropertyKind.cs
- BackoffTimeoutHelper.cs
- DeclarativeCatalogPart.cs