GiveFeedbackEventArgs.Effect 속성

정의

표시되는 끌어서 놓기 작업 피드백을 가져옵니다.

public:
 property System::Windows::Forms::DragDropEffects Effect { System::Windows::Forms::DragDropEffects get(); };
public System.Windows.Forms.DragDropEffects Effect { get; }
member this.Effect : System.Windows.Forms.DragDropEffects
Public ReadOnly Property Effect As DragDropEffects

속성 값

값 중 DragDropEffects 하나입니다.

예제

다음 예제에서는 두 ListBox 컨트롤 간의 끌어서 놓기 작업을 보여 줍니다. 이 예제에서는 끌기 작업이 시작될 때 메서드를 호출 DoDragDrop 합니다. 이벤트 중에 SystemInformation.DragSize 마우스가 마우스 위치보다 MouseDown 많이 이동한 경우 끌기 작업이 시작됩니다. 이 IndexFromPoint 메서드는 이벤트 중에 끌 항목의 인덱스 MouseDown 확인에 사용됩니다.

또한 이 예제에서는 끌어서 놓기 작업에 사용자 지정 커서를 사용하는 방법을 보여 줍니다. 이 예제에서는 두 개의 커서 파일이 3dwarro.cur3dwno.cur각각 사용자 지정 끌어서 놓기 및 놓지 않는 커서에 대해 애플리케이션 디렉터리에 있다고 가정합니다. 사용자 지정 커서는 선택된 경우 UseCustomCursorsCheckCheckBox 사용됩니다. 사용자 지정 커서는 이벤트 처리기에서 GiveFeedback 설정됩니다.

키보드 상태는 오른쪽DragOverListBox 대한 이벤트 처리기에서 평가되며 Shift, Ctrl, Alt 또는 Ctrl+Alt 키의 상태에 따라 끌기 작업을 결정합니다. 드롭이 ListBox 발생하는 위치도 이벤트 중에 DragOver 결정됩니다. 삭제할 데이터가 아닌 String경우 이 DragEventArgs.Effect 값은 .로 DragDropEffects.None설정됩니다. 마지막으로 삭제 상태가 에 표시됩니다 DropLocationLabelLabel.

오른쪽 ListBox 에 대해 삭제할 데이터는 이벤트 처리기에서 DragDrop 결정되며 String 값은 해당 위치에 추가됩니다 ListBox. 끌기 작업이 폼의 범위를 벗어나면 이벤트 처리기에서 QueryContinueDrag 끌어서 놓기 작업이 취소됩니다.

이 코드 발췌에서는 클래스를 사용하는 방법을 보여 줍니다 GiveFeedbackEventArgs . DoDragDrop 전체 코드 예제는 메서드를 참조하세요.

void ListDragSource_GiveFeedback( Object^ /*sender*/, System::Windows::Forms::GiveFeedbackEventArgs^ e )
{
   // Use custom cursors if the check box is checked.
   if ( UseCustomCursorsCheck->Checked )
   {
      // Sets the custom cursor based upon the effect.
      e->UseDefaultCursors = false;
      if ( (e->Effect & DragDropEffects::Move) == DragDropEffects::Move )
                  ::Cursor::Current = MyNormalCursor;
      else
                  ::Cursor::Current = MyNoDropCursor;
   }
}
private void ListDragSource_GiveFeedback(object sender, GiveFeedbackEventArgs e)
{
    // Use custom cursors if the check box is checked.
    if (UseCustomCursorsCheck.Checked)
    {
        // Sets the custom cursor based upon the effect.
        e.UseDefaultCursors = false;
        if ((e.Effect & DragDropEffects.Move) == DragDropEffects.Move)
            Cursor.Current = MyNormalCursor;
        else
            Cursor.Current = MyNoDropCursor;
    }
}
Private Sub ListDragSource_GiveFeedback(ByVal sender As Object, ByVal e As GiveFeedbackEventArgs) Handles ListDragSource.GiveFeedback
    ' Use custom cursors if the check box is checked.
    If (UseCustomCursorsCheck.Checked) Then

        ' Set the custom cursor based upon the effect.
        e.UseDefaultCursors = False
        If ((e.Effect And DragDropEffects.Move) = DragDropEffects.Move) Then
            Cursor.Current = MyNormalCursor
        Else
            Cursor.Current = MyNoDropCursor
        End If
    End If

End Sub

적용 대상