Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ApplicationContext.cs
- TreeBuilder.cs
- TextAutomationPeer.cs
- HtmlAnchor.cs
- DataSourceExpressionCollection.cs
- FormatConvertedBitmap.cs
- CompilerGlobalScopeAttribute.cs
- FileResponseElement.cs
- DrawingContextDrawingContextWalker.cs
- HashHelper.cs
- SqlDataSourceView.cs
- SmtpNetworkElement.cs
- AttributeData.cs
- DesignColumnCollection.cs
- VirtualPathProvider.cs
- PanelStyle.cs
- RepeaterItemEventArgs.cs
- EntityDataSourceWrapperCollection.cs
- BinHexDecoder.cs
- OleDbConnectionInternal.cs
- FactoryId.cs
- RelationshipEndMember.cs
- AnnotationDocumentPaginator.cs
- KeyboardDevice.cs
- XamlSerializerUtil.cs
- CompensationHandlingFilter.cs
- EventLogger.cs
- PerformanceCounterPermissionEntry.cs
- ToolboxItemFilterAttribute.cs
- Comparer.cs
- HelpProvider.cs
- mactripleDES.cs
- DescendentsWalker.cs
- DispatcherProcessingDisabled.cs
- XmlAnyElementAttributes.cs
- ReachPageContentSerializer.cs
- SelectorAutomationPeer.cs
- RpcAsyncResult.cs
- FrameworkTemplate.cs
- CellParaClient.cs
- SoapSchemaExporter.cs
- ConsumerConnectionPointCollection.cs
- HttpCacheVary.cs
- FormCollection.cs
- ConstructorArgumentAttribute.cs
- ValidationErrorEventArgs.cs
- TearOffProxy.cs
- XmlDictionaryString.cs
- MouseGesture.cs
- ListItemParagraph.cs
- SortQuery.cs
- XmlSecureResolver.cs
- EndpointPerformanceCounters.cs
- XamlPoint3DCollectionSerializer.cs
- LicenseException.cs
- RequestCachePolicy.cs
- SecurityIdentifierConverter.cs
- ECDsa.cs
- ZipIOExtraFieldPaddingElement.cs
- TextElement.cs
- XmlSchemaAnnotation.cs
- WCFModelStrings.Designer.cs
- SelectedDatesCollection.cs
- keycontainerpermission.cs
- InternalConfigEventArgs.cs
- PointHitTestResult.cs
- SchemaHelper.cs
- ToolStripDropDownClosingEventArgs.cs
- BitmapScalingModeValidation.cs
- BrowsableAttribute.cs
- AttributeCollection.cs
- TemplatedMailWebEventProvider.cs
- WebControlAdapter.cs
- CodeRegionDirective.cs
- MediaSystem.cs
- DoubleMinMaxAggregationOperator.cs
- BasicHttpMessageSecurityElement.cs
- SmtpSection.cs
- ObfuscationAttribute.cs
- DesignerForm.cs
- CaseDesigner.xaml.cs
- ToolboxDataAttribute.cs
- GroupDescription.cs
- SQLDateTimeStorage.cs
- RuntimeConfigLKG.cs
- PtsContext.cs
- RepeatButtonAutomationPeer.cs
- LocalBuilder.cs
- UndirectedGraph.cs
- ConfigurationHelpers.cs
- GridSplitter.cs
- OdbcCommand.cs
- Object.cs
- WindowsProgressbar.cs
- RoleGroupCollection.cs
- DNS.cs
- SRGSCompiler.cs
- HelpEvent.cs
- CommonBehaviorsSection.cs
- _ShellExpression.cs