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
- AQNBuilder.cs
- KeyToListMap.cs
- InstanceValue.cs
- DataSetUtil.cs
- SqlAggregateChecker.cs
- UpdateException.cs
- SequentialActivityDesigner.cs
- SafeNativeMethods.cs
- MenuItem.cs
- AudioSignalProblemOccurredEventArgs.cs
- Vector.cs
- NamespaceQuery.cs
- TranslateTransform3D.cs
- PromptEventArgs.cs
- BoundField.cs
- XmlWellformedWriter.cs
- DesignerActionItemCollection.cs
- FactoryRecord.cs
- StylusPlugInCollection.cs
- XmlBinaryReader.cs
- XmlSchemaChoice.cs
- CheckedListBox.cs
- RubberbandSelector.cs
- DataGrid.cs
- COM2ColorConverter.cs
- QuaternionValueSerializer.cs
- WebPartCancelEventArgs.cs
- ClientTargetCollection.cs
- ToolStripProgressBar.cs
- StringExpressionSet.cs
- InstallerTypeAttribute.cs
- LogLogRecordHeader.cs
- XpsException.cs
- HtmlInputControl.cs
- BaseComponentEditor.cs
- BrowserCapabilitiesCodeGenerator.cs
- LambdaCompiler.Binary.cs
- XmlStreamNodeWriter.cs
- XmlObjectSerializerReadContext.cs
- EncryptedKey.cs
- XmlNodeWriter.cs
- CompilerInfo.cs
- PropertyManager.cs
- GestureRecognizer.cs
- DocumentationServerProtocol.cs
- SmiEventSink.cs
- IsolatedStoragePermission.cs
- Button.cs
- AuthenticateEventArgs.cs
- ScrollContentPresenter.cs
- ProviderUtil.cs
- GridToolTip.cs
- OnOperation.cs
- DynamicValidatorEventArgs.cs
- NavigationService.cs
- DateTimeValueSerializerContext.cs
- ReadOnlyCollectionBuilder.cs
- QueryPageSettingsEventArgs.cs
- XmlTextWriter.cs
- XmlDownloadManager.cs
- FragmentQuery.cs
- OleDbEnumerator.cs
- CharacterHit.cs
- WindowsListViewSubItem.cs
- FormatConvertedBitmap.cs
- EntityDataSourceDesigner.cs
- NamespaceList.cs
- WebConfigurationFileMap.cs
- SchemaImporter.cs
- OperationSelectorBehavior.cs
- TableRow.cs
- DesignTimeParseData.cs
- DiscoveryInnerClientManaged11.cs
- AtomParser.cs
- CounterCreationDataCollection.cs
- ProcessInfo.cs
- ListItemCollection.cs
- Enum.cs
- GAC.cs
- TextWriterTraceListener.cs
- DataGridViewHitTestInfo.cs
- Canonicalizers.cs
- Triangle.cs
- ExceptionHandler.cs
- QueryOutputWriter.cs
- FacetChecker.cs
- DataRecord.cs
- FunctionQuery.cs
- CharEntityEncoderFallback.cs
- Filter.cs
- DescendantBaseQuery.cs
- DateTimeOffsetAdapter.cs
- XmlIncludeAttribute.cs
- XmlCharacterData.cs
- TableLayoutSettings.cs
- TextServicesProperty.cs
- TryCatchDesigner.xaml.cs
- FlowDocumentFormatter.cs
- StringAnimationUsingKeyFrames.cs
- MenuCommands.cs