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
- StylusButtonEventArgs.cs
- AssemblyInfo.cs
- ActivityInstanceReference.cs
- RMEnrollmentPage1.cs
- FileSecurity.cs
- SectionRecord.cs
- FrameDimension.cs
- RedistVersionInfo.cs
- iisPickupDirectory.cs
- ResolvedKeyFrameEntry.cs
- DesignerWithHeader.cs
- EastAsianLunisolarCalendar.cs
- HostedElements.cs
- HwndHost.cs
- XmlSchemaFacet.cs
- WebServiceBindingAttribute.cs
- ActivationServices.cs
- CharacterShapingProperties.cs
- HostProtectionPermission.cs
- DataGridColumnDropSeparator.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- SystemIPv4InterfaceProperties.cs
- Shared.cs
- SecurityUtils.cs
- DeflateStream.cs
- CheckedListBox.cs
- InkPresenter.cs
- DocumentReferenceCollection.cs
- XmlTypeMapping.cs
- ActivationArguments.cs
- ListBox.cs
- RuntimeHandles.cs
- SqlXmlStorage.cs
- CardSpaceShim.cs
- SystemWebCachingSectionGroup.cs
- FrameworkContentElement.cs
- DataShape.cs
- Thread.cs
- CodeNamespace.cs
- MinimizableAttributeTypeConverter.cs
- SmiMetaData.cs
- Task.cs
- SkipStoryboardToFill.cs
- CompilerError.cs
- EntityProviderFactory.cs
- ConfigurationLockCollection.cs
- DirectoryNotFoundException.cs
- ComponentChangedEvent.cs
- CommonDialog.cs
- BasicViewGenerator.cs
- WebPartZoneBase.cs
- dbdatarecord.cs
- WebPartConnectionCollection.cs
- FontStretches.cs
- VisualStyleTypesAndProperties.cs
- Matrix3D.cs
- Geometry3D.cs
- EditorZoneDesigner.cs
- WindowsListViewGroupSubsetLink.cs
- CellIdBoolean.cs
- CheckoutException.cs
- EntityTransaction.cs
- Convert.cs
- Typeface.cs
- UserMapPath.cs
- WebDescriptionAttribute.cs
- SubstitutionList.cs
- RecognizerInfo.cs
- InvalidCommandTreeException.cs
- SqlConnectionPoolGroupProviderInfo.cs
- SelfSignedCertificate.cs
- ISCIIEncoding.cs
- ListViewContainer.cs
- DeriveBytes.cs
- ConfigPathUtility.cs
- BitmapEffectCollection.cs
- DataGridViewDataConnection.cs
- BasicKeyConstraint.cs
- ScriptIgnoreAttribute.cs
- CommandHelpers.cs
- ConfigurationPropertyCollection.cs
- BinaryNode.cs
- sqlser.cs
- LogExtentCollection.cs
- MouseEvent.cs
- BitmapEffectInput.cs
- DataGridViewToolTip.cs
- GridItemCollection.cs
- validationstate.cs
- AudioFileOut.cs
- HtmlInputReset.cs
- KeyNotFoundException.cs
- ConstraintStruct.cs
- Popup.cs
- input.cs
- Cast.cs
- IntranetCredentialPolicy.cs
- baseaxisquery.cs
- AccessDataSourceView.cs
- WindowsAuthenticationModule.cs