ToolStripItem.DragDrop 이벤트

정의

사용자가 항목을 끌어 이 항목에 해당 항목을 놓도록 마우스를 놓을 때 발생합니다.

public:
 event System::Windows::Forms::DragEventHandler ^ DragDrop;
[System.ComponentModel.Browsable(false)]
public event System.Windows.Forms.DragEventHandler DragDrop;
[<System.ComponentModel.Browsable(false)>]
member this.DragDrop : System.Windows.Forms.DragEventHandler 
Public Custom Event DragDrop As DragEventHandler 

이벤트 유형

DragEventHandler
특성

예제

다음 코드 예제에서는 클라이언트Point와 속성을 변환 X Y 하는 방법을 보여 있습니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 ToolStripRenderer 클래스입니다.

// This method defines the DragOver event behavior. 
protected override void OnDragOver(DragEventArgs dea)
{
    base.OnDragOver(dea);

    // Get the ToolStripButton control 
    // at the given mouse position.
    Point p = new Point(dea.X, dea.Y);
    ToolStripButton item = this.GetItemAt(
        this.PointToClient(p)) as ToolStripButton;

    // If the ToolStripButton control is the empty cell,
    // indicate that the move operation is valid.
    if( item == this.emptyCellButton )
    {
        // Set the drag operation to indicate a valid move.
        dea.Effect = DragDropEffects.Move;
    }
}
' This method defines the DragOver event behavior. 
Protected Overrides Sub OnDragOver(dea As DragEventArgs)
   MyBase.OnDragOver(dea)
   
   ' Get the ToolStripButton control 
   ' at the given mouse position.
   Dim p As New Point(dea.X, dea.Y)
   Dim item As ToolStripButton = CType(Me.GetItemAt(Me.PointToClient(p)), ToolStripButton)
   
   
   ' If the ToolStripButton control is the empty cell,
   ' indicate that the move operation is valid.
     If item Is Me.emptyCellButton Then
         ' Set the drag operation to indicate a valid move.
         dea.Effect = DragDropEffects.Move
     End If
 End Sub

설명

Y 및 속성 DragEventArgsX 클라이언트 좌표가 아닌 화면 좌표에 있습니다. 이벤트 처리에 대한 자세한 내용은 이벤트 처리 및 발생 을 참조하십시오.

적용 대상