Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- DataGridViewToolTip.cs
- TargetInvocationException.cs
- Privilege.cs
- SourceElementsCollection.cs
- MetadataArtifactLoaderFile.cs
- TypeUtil.cs
- DefaultPrintController.cs
- TagPrefixCollection.cs
- DesignerAutoFormatStyle.cs
- DateTimeOffset.cs
- SerializerProvider.cs
- AttributeCallbackBuilder.cs
- WebPartHeaderCloseVerb.cs
- ImageMetadata.cs
- InputLanguageSource.cs
- ToolBarButton.cs
- EventSetter.cs
- HandlerWithFactory.cs
- XmlExtensionFunction.cs
- WorkflowItemsPresenter.cs
- EditorZone.cs
- XmlILConstructAnalyzer.cs
- RayHitTestParameters.cs
- ImageSource.cs
- TrackingMemoryStreamFactory.cs
- XmlSerializer.cs
- DataBindingCollection.cs
- PrivilegeNotHeldException.cs
- EtwTrace.cs
- UrlMappingCollection.cs
- ServiceBehaviorElement.cs
- SessionViewState.cs
- HwndSource.cs
- COM2IProvidePropertyBuilderHandler.cs
- SystemDropShadowChrome.cs
- DeadCharTextComposition.cs
- Msec.cs
- Timeline.cs
- MouseBinding.cs
- UnsafeNativeMethods.cs
- FontFamilyConverter.cs
- HtmlInputButton.cs
- WindowsToolbarItemAsMenuItem.cs
- HtmlTableCell.cs
- ObjectDataSourceSelectingEventArgs.cs
- StaticDataManager.cs
- UniqueEventHelper.cs
- ImmutablePropertyDescriptorGridEntry.cs
- DispatcherHookEventArgs.cs
- RuleSetCollection.cs
- HttpApplication.cs
- DataGridViewCellMouseEventArgs.cs
- ImportCatalogPart.cs
- _NestedMultipleAsyncResult.cs
- PreservationFileWriter.cs
- ConnectivityStatus.cs
- TypeUnloadedException.cs
- ResponseBodyWriter.cs
- XmlSchemaImporter.cs
- MulticastNotSupportedException.cs
- BinaryParser.cs
- InfocardExtendedInformationEntry.cs
- DataProtection.cs
- TailPinnedEventArgs.cs
- PathParser.cs
- ObjectSecurity.cs
- dtdvalidator.cs
- TemplateBuilder.cs
- XmlSchemaNotation.cs
- AttachedAnnotationChangedEventArgs.cs
- SoapMessage.cs
- BooleanKeyFrameCollection.cs
- VarRemapper.cs
- TreeViewImageKeyConverter.cs
- Literal.cs
- CustomAssemblyResolver.cs
- FixedSOMLineRanges.cs
- Transform3D.cs
- NativeMethods.cs
- InvokeMethod.cs
- NavigatorOutput.cs
- Schema.cs
- HandleCollector.cs
- BinaryFormatterWriter.cs
- CultureSpecificCharacterBufferRange.cs
- filewebrequest.cs
- AbstractExpressions.cs
- PbrsForward.cs
- EventSource.cs
- DataSourceCollectionBase.cs
- SingleAnimationUsingKeyFrames.cs
- HtmlInputControl.cs
- httpapplicationstate.cs
- QuotedPrintableStream.cs
- ContextDataSource.cs
- EventRoute.cs
- TriggerAction.cs
- ScriptingRoleServiceSection.cs
- DataSetSchema.cs
- MailWriter.cs