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
- URI.cs
- TextElement.cs
- DiscreteKeyFrames.cs
- Empty.cs
- ZipIOExtraFieldElement.cs
- DataTableMappingCollection.cs
- NamespaceDisplay.xaml.cs
- TableStyle.cs
- DnsPermission.cs
- Italic.cs
- FlowchartSizeFeature.cs
- DataReceivedEventArgs.cs
- BitmapEffectCollection.cs
- XPathAxisIterator.cs
- CAGDesigner.cs
- InstallerTypeAttribute.cs
- XmlSerializationWriter.cs
- XmlAutoDetectWriter.cs
- GroupPartitionExpr.cs
- PasswordPropertyTextAttribute.cs
- ByteAnimation.cs
- WSUtilitySpecificationVersion.cs
- PropertyChangedEventArgs.cs
- StreamReader.cs
- CompilerErrorCollection.cs
- OptimalBreakSession.cs
- CopyAction.cs
- EventProviderWriter.cs
- GeneralTransform2DTo3DTo2D.cs
- DataGridViewAutoSizeModeEventArgs.cs
- FieldNameLookup.cs
- TypeGenericEnumerableViewSchema.cs
- CatalogZoneBase.cs
- DesignColumn.cs
- MatrixCamera.cs
- ObjectDataSourceFilteringEventArgs.cs
- IsolatedStorageFilePermission.cs
- TripleDESCryptoServiceProvider.cs
- ProtocolsSection.cs
- EntitySqlQueryState.cs
- BitmapEffectState.cs
- WebPartConnectionsCloseVerb.cs
- PropertyDescriptorCollection.cs
- BuildProvidersCompiler.cs
- CubicEase.cs
- ConnectionsZone.cs
- DesigntimeLicenseContextSerializer.cs
- PackageDigitalSignature.cs
- BitmapMetadataEnumerator.cs
- ping.cs
- DataControlFieldHeaderCell.cs
- DrawingGroup.cs
- CompilerTypeWithParams.cs
- ResizingMessageFilter.cs
- IteratorFilter.cs
- StringComparer.cs
- DrawingBrush.cs
- TemplateControlParser.cs
- BoundColumn.cs
- SchemaNamespaceManager.cs
- StylusPointProperty.cs
- PackageStore.cs
- ObjectDataSourceMethodEventArgs.cs
- JapaneseCalendar.cs
- PageBuildProvider.cs
- Help.cs
- FontSizeConverter.cs
- DropSource.cs
- ItemChangedEventArgs.cs
- ScriptMethodAttribute.cs
- Baml6ConstructorInfo.cs
- ListParagraph.cs
- CodeEntryPointMethod.cs
- Soap.cs
- CroppedBitmap.cs
- ServiceDescriptionImporter.cs
- SQLDecimalStorage.cs
- ProcessManager.cs
- ValidationHelper.cs
- SHA512.cs
- CapabilitiesState.cs
- SqlDataReader.cs
- TypeEnumerableViewSchema.cs
- WebPartConnection.cs
- DbLambda.cs
- XmlBufferReader.cs
- Permission.cs
- Attributes.cs
- RtfToXamlReader.cs
- CompositeControlDesigner.cs
- Point.cs
- AssemblyHash.cs
- MobileFormsAuthentication.cs
- PropertyNames.cs
- XmlLinkedNode.cs
- CodeConstructor.cs
- UnsafeNativeMethods.cs
- OAVariantLib.cs
- ListManagerBindingsCollection.cs
- ToolBarPanel.cs