ArcObjects Library Reference (Controls)  

IPageLayoutControlEvents.OnOleDrop Event

Fires when an OLE drop action occurs on the PageLayoutControl.

[Visual Basic 6.0]
Event OnOleDrop(
    ByVal dropAction As esriControlsDropAction, _
    ByVal dataObjectHelper As Variant, _
    effect As Long, _
    ByVal button As Long, _
    ByVal shift As Long, _
    ByVal X As Long, _
    ByVal Y As Long _
) As Empty
[Visual Basic .NET]
Public Event OnOleDrop As OnOleDropEventHandler
[C#]
public event OnOleDropEventHandler OnOleDrop
[C++]
HRESULT OnOleDrop(
  esriControlsDropAction dropAction,
  VARIANT dataObjectHelper,
  long* 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

Product Availability

Available with ArcGIS Engine.

Description

If the IPageLayoutControl::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 IPageLayoutControl::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 PageLayoutControl.

Remarks

Use the esriDropOver dropAction to display mouse coordinates while data is being dragged over the PageLayoutControl from another application, as the OnMouseMove event will not be triggered.

[C#]
private void axPageLayoutControl1_OnOleDrop(object sender, ESRI.ArcGIS.PageLayoutControl.IPageLayoutControlEvents_OnOleDropEvent e)
{
    switch (e.dropAction)
    {
        //Data entering the PageLayoutControl
        case esriControlsDropAction.esriDropEnter:
            //Do something..
            break;
        //Data dragged over thePageLayoutControl
        case esriControlsDropAction.esriDropOver:
            label1.Text = "x:" + e.x + "  y:" + e.y;
            label1.Refresh();
            break;
        //Data leaving thePageLayoutControl
        case esriControlsDropAction.esriDropLeave:
            //Do something...
            break;
        //Data dropped onto thePageLayoutControl
        case esriControlsDropAction.esriDropped :
            //Do something...
            break;
     }
}
[Visual Basic .NET]
Private Sub AxPageLayoutControl1_OnOleDrop(ByVal sender As Object, ByVal e As ESRI.ArcGIS.PageLayoutControl.IPageLayoutControlEvents_OnOleDropEvent) Handles AxPageLayoutControl1.OnOleDrop 
    'Data entering the PageLayoutControl
    If e.dropAction = esriControlsDropAction.esriDropEnter Then
        'Do something...
    'Data dragged over thePageLayoutControl
    ElseIf e.dropAction = esriControlsDropAction.esriDropOver Then
         Label1.Text = "x:" & e.x & "  y:" & e.y
         Label1.Refresh()
    'Data leaving thePageLayoutControl
    ElseIf e.dropAction = esriControlsDropAction.esriDropLeave Then
         'Do something...
    'Data dropped onto thePageLayoutControl
     ElseIf e.dropAction = esriControlsDropAction.esriDropped Then
        'Do something...
     End If
End Sub

See Also

IPageLayoutControlEvents Interface