Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / DropSource.cs / 1305376 / 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
- MouseButton.cs
- FormViewRow.cs
- TypeProvider.cs
- PrintingPermissionAttribute.cs
- ForceCopyBuildProvider.cs
- RC2.cs
- MainMenu.cs
- ChannelToken.cs
- ToolBar.cs
- Size.cs
- ManagementException.cs
- ClrPerspective.cs
- ObjectStateEntryDbDataRecord.cs
- DataContractAttribute.cs
- VectorValueSerializer.cs
- SchemaCollectionCompiler.cs
- VerticalAlignConverter.cs
- WebRequestModuleElementCollection.cs
- StringTraceRecord.cs
- TabPanel.cs
- httpapplicationstate.cs
- ProcessManager.cs
- EntityDataSourceStatementEditor.cs
- RuntimeConfigLKG.cs
- UnauthorizedWebPart.cs
- HtmlEmptyTagControlBuilder.cs
- ModifierKeysValueSerializer.cs
- DiscreteKeyFrames.cs
- CodeTypeReferenceSerializer.cs
- Sql8ConformanceChecker.cs
- XpsPartBase.cs
- CryptoKeySecurity.cs
- CompilationSection.cs
- RangeContentEnumerator.cs
- EditorResources.cs
- CheckBoxField.cs
- DetailsViewPagerRow.cs
- SchemaTableColumn.cs
- DynamicActivityXamlReader.cs
- RayMeshGeometry3DHitTestResult.cs
- JapaneseLunisolarCalendar.cs
- DataServiceRequestException.cs
- DataGridViewRowsRemovedEventArgs.cs
- DataBindingHandlerAttribute.cs
- Condition.cs
- SizeKeyFrameCollection.cs
- SerializeAbsoluteContext.cs
- ForEachAction.cs
- StringOutput.cs
- CacheRequest.cs
- Parallel.cs
- PieceNameHelper.cs
- XmlMemberMapping.cs
- ProvidePropertyAttribute.cs
- DirectoryObjectSecurity.cs
- WebBrowserPermission.cs
- MergeFilterQuery.cs
- TreeViewAutomationPeer.cs
- ExpressionList.cs
- WindowsNonControl.cs
- LineUtil.cs
- SudsParser.cs
- AutoGeneratedFieldProperties.cs
- _Semaphore.cs
- SerializationObjectManager.cs
- ParsedAttributeCollection.cs
- QilCloneVisitor.cs
- StorageMappingItemCollection.cs
- InfoCardMasterKey.cs
- ReadOnlyDictionary.cs
- AttributeUsageAttribute.cs
- SafeFindHandle.cs
- Debug.cs
- TableRow.cs
- SizeValueSerializer.cs
- FilteredAttributeCollection.cs
- ThrowHelper.cs
- BuiltInExpr.cs
- WindowsListViewItemStartMenu.cs
- NumberSubstitution.cs
- DBPropSet.cs
- NetNamedPipeSecurityMode.cs
- TrackingConditionCollection.cs
- ExtensionSimplifierMarkupObject.cs
- VarRefManager.cs
- SchemaDeclBase.cs
- DBPropSet.cs
- AttributeData.cs
- SelectedGridItemChangedEvent.cs
- Stackframe.cs
- DbConnectionInternal.cs
- CodeCastExpression.cs
- TrackingProvider.cs
- PersonalizationAdministration.cs
- SqlAliaser.cs
- EdmEntityTypeAttribute.cs
- ToolBarButton.cs
- RequestCacheManager.cs
- RootAction.cs
- TextLineResult.cs