This document is archived and information here might be outdated. Recommended version. |
Fires when an OLE drop action occurs on the MapControl.
[Visual Basic .NET] Public Event OnOleDrop As OnOleDropEventHandler
[C#] public event OnOleDropEventHandler OnOleDrop
[C++]
HRESULT OnOleDrop(
esriControlsDropAction dropAction,
VARIANT dataObjectHelper,
System.Int32* effect,
long button,
long shift,
long X,
long Y
);
[C++] Parameters dropAction [in]
dropAction is a parameter of type esriControlsDropAction dataObjectHelper [in]
dataObjectHelper is a parameter of type VARIANT effect [in, out]
effect is a parameter of type long* button [in]
button is a parameter of type long shift [in]
shift is a parameter of type long X [in]
X is a parameter of type long Y [in]
Y is a parameter of type long
If the IMapControl2::OleDropEnabled property is set to False the OnOleDrop event will not be triggered, and the esriDragDropNone effect will display when data is dragged over the control.
If the IMapControl2::OleDropEnabled property is set to True the esriControlsDragDropEffect must be set each time the OnOleDrop event is triggered.
Use the esriControlsDropAction constant to determine whether the data is entering or leaving the control, or whether data is being dragged over or dropped onto the MapControl.
Use the esriDropOver dropAction to display mouse coordinates while data is being dragged over the MapControl from another application, as the OnMouseMove event will not be triggered.
private void axMapControl1_OnOleDrop(object sender, ESRI.ArcGIS.MapControl.IMapControlEvents2_OnOleDropEvent e)
{
switch (e.dropAction)
{
//Data entering the
case esriControlsDropAction.esriDropEnter:
//Do something...
break;
//Data dragged over the MapControl
case esriControlsDropAction.esriDropOver:
label1.Text = "x:" + e.x + " y:" + e.y;
label1.Refresh();
break;
//Data leaving the MapControl
case esriControlsDropAction.esriDropLeave:
//Do something...
break;
//Data dropped onto MapControl
case esriControlsDropAction.esriDropped :
//Do something...
break;
}
}
Private Sub AxMapControl1_OnOleDrop(ByVal sender As Object, ByVal e As ESRI.ArcGIS.MapControl.IMapControlEvents2_OnOleDropEvent) Handles AxMapControl1.OnOleDrop
'Data entering the MapControl
If e.dropAction = esriControlsDropAction.esriDropEnter Then
'Do something...
'Data dragged over the MapControl
ElseIf e.dropAction = esriControlsDropAction.esriDropOver Then
Label1.Text = "x:" & e.x & " y:" & e.y
Label1.Refresh()
'Data leaving the MapControl
ElseIf e.dropAction = esriControlsDropAction.esriDropLeave Then
'Do something...
'Data dropped onto the MapControl
ElseIf e.dropAction = esriControlsDropAction.esriDropped Then
'Do something...
End If
End Sub