Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- NameTable.cs
- CircleHotSpot.cs
- Label.cs
- BindingCollection.cs
- StrokeCollectionConverter.cs
- DataSetUtil.cs
- ConsoleTraceListener.cs
- TableRow.cs
- CryptoConfig.cs
- ProfileGroupSettingsCollection.cs
- ListControlConvertEventArgs.cs
- GridProviderWrapper.cs
- GradientBrush.cs
- XmlStreamStore.cs
- PeerFlooder.cs
- OracleBFile.cs
- BitmapData.cs
- InternalResources.cs
- SamlAuthenticationStatement.cs
- ObfuscateAssemblyAttribute.cs
- sqlinternaltransaction.cs
- CommonObjectSecurity.cs
- SecurityHeader.cs
- ThreadAttributes.cs
- SqlConnectionFactory.cs
- ConnectionsZone.cs
- PeerNameResolver.cs
- SQLCharsStorage.cs
- ProcessModelInfo.cs
- DateTimeAutomationPeer.cs
- WebResourceUtil.cs
- ComponentDispatcher.cs
- AmbientLight.cs
- Inflater.cs
- InvokeSchedule.cs
- DefinitionUpdate.cs
- TemplateNameScope.cs
- LicenseManager.cs
- DBCSCodePageEncoding.cs
- AttachedPropertyBrowsableAttribute.cs
- ContainerActivationHelper.cs
- cookieexception.cs
- EditorZone.cs
- Base64Encoding.cs
- XmlComplianceUtil.cs
- MultipartContentParser.cs
- WhitespaceSignificantCollectionAttribute.cs
- DrawingImage.cs
- SqlHelper.cs
- XPathNodePointer.cs
- CurrentChangedEventManager.cs
- PrimarySelectionGlyph.cs
- GridPattern.cs
- RegexCompiler.cs
- ConstructorArgumentAttribute.cs
- SafeRightsManagementQueryHandle.cs
- ipaddressinformationcollection.cs
- TypeUsageBuilder.cs
- NavigationPropertyAccessor.cs
- HostedImpersonationContext.cs
- XmlHierarchyData.cs
- TemplatedWizardStep.cs
- Cursors.cs
- Parameter.cs
- RelationshipSet.cs
- BitmapEffectrendercontext.cs
- CharEnumerator.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- PageCatalogPart.cs
- StringSource.cs
- RegionInfo.cs
- StyleBamlRecordReader.cs
- MessageFormatterConverter.cs
- PixelShader.cs
- SqlTriggerAttribute.cs
- StringArrayConverter.cs
- RotateTransform.cs
- HtmlProps.cs
- SharedPersonalizationStateInfo.cs
- MergeLocalizationDirectives.cs
- BrowserCapabilitiesFactory.cs
- RtfNavigator.cs
- HttpRawResponse.cs
- XPathNodeInfoAtom.cs
- DrawingContext.cs
- GlyphsSerializer.cs
- Documentation.cs
- WindowsListBox.cs
- Method.cs
- OperationResponse.cs
- HyperLinkStyle.cs
- figurelengthconverter.cs
- SystemKeyConverter.cs
- ResourcePool.cs
- BaseCAMarshaler.cs
- MsmqIntegrationProcessProtocolHandler.cs
- DataBoundControlAdapter.cs
- XNodeSchemaApplier.cs
- CategoryAttribute.cs
- ProfilePropertyMetadata.cs