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
- RelationshipDetailsCollection.cs
- HttpCacheVaryByContentEncodings.cs
- WebUtility.cs
- DataGridViewCellStateChangedEventArgs.cs
- ImageKeyConverter.cs
- HealthMonitoringSection.cs
- DefaultBinder.cs
- SystemIPGlobalProperties.cs
- ErrorWebPart.cs
- PriorityBinding.cs
- GeneralTransform3D.cs
- CharAnimationUsingKeyFrames.cs
- DiscriminatorMap.cs
- Application.cs
- ServiceOperationParameter.cs
- SchemaComplexType.cs
- XsdDateTime.cs
- WebPartCloseVerb.cs
- LineInfo.cs
- BaseDataList.cs
- Workspace.cs
- LinqDataSourceSelectEventArgs.cs
- QueryCreatedEventArgs.cs
- WebConfigurationFileMap.cs
- SqlRetyper.cs
- MemberJoinTreeNode.cs
- TypedTableBase.cs
- CodeDomExtensionMethods.cs
- Drawing.cs
- CodeDirectoryCompiler.cs
- TimeZone.cs
- HiddenField.cs
- RecoverInstanceLocksCommand.cs
- InputQueueChannelAcceptor.cs
- Rect3D.cs
- ObjectItemCollection.cs
- Application.cs
- ExpandableObjectConverter.cs
- ServiceDescriptionContext.cs
- Util.cs
- ReadOnlyNameValueCollection.cs
- FieldNameLookup.cs
- WebEventTraceProvider.cs
- FontSizeConverter.cs
- IPAddressCollection.cs
- DataControlPagerLinkButton.cs
- StackOverflowException.cs
- ResizeGrip.cs
- ValidatorCompatibilityHelper.cs
- Cursors.cs
- KeyFrames.cs
- EdmEntityTypeAttribute.cs
- AtomicFile.cs
- FixedSOMTextRun.cs
- SelectionChangedEventArgs.cs
- IIS7UserPrincipal.cs
- SettingsPropertyIsReadOnlyException.cs
- AnyReturnReader.cs
- MexHttpsBindingElement.cs
- TraceContextRecord.cs
- Dictionary.cs
- XmlTextWriter.cs
- QilTypeChecker.cs
- TriggerActionCollection.cs
- GridViewDeletedEventArgs.cs
- Size.cs
- VirtualDirectoryMapping.cs
- BamlVersionHeader.cs
- DocumentReferenceCollection.cs
- PersianCalendar.cs
- VisualTreeHelper.cs
- DataBoundControlAdapter.cs
- PasswordBox.cs
- WebPartCollection.cs
- IDispatchConstantAttribute.cs
- GridViewItemAutomationPeer.cs
- AutoGeneratedFieldProperties.cs
- FontSourceCollection.cs
- ByteArrayHelperWithString.cs
- StateManagedCollection.cs
- AsynchronousChannel.cs
- StrongNameIdentityPermission.cs
- SamlSerializer.cs
- CodeArrayIndexerExpression.cs
- EventWaitHandle.cs
- MethodAccessException.cs
- XmlCharCheckingWriter.cs
- HttpTransportSecurityElement.cs
- TableItemProviderWrapper.cs
- PrimitiveXmlSerializers.cs
- WindowHideOrCloseTracker.cs
- InkCollectionBehavior.cs
- SafeProcessHandle.cs
- RowsCopiedEventArgs.cs
- LicenseException.cs
- SelectedDatesCollection.cs
- Blend.cs
- RelatedImageListAttribute.cs
- MulticastDelegate.cs
- IpcChannelHelper.cs