GiveFeedbackEventHandler 대리자

정의

ControlGiveFeedback 이벤트를 처리하는 메서드를 나타냅니다.

public delegate void GiveFeedbackEventHandler(System::Object ^ sender, GiveFeedbackEventArgs ^ e);
public delegate void GiveFeedbackEventHandler(object sender, GiveFeedbackEventArgs e);
public delegate void GiveFeedbackEventHandler(object? sender, GiveFeedbackEventArgs e);
type GiveFeedbackEventHandler = delegate of obj * GiveFeedbackEventArgs -> unit
Public Delegate Sub GiveFeedbackEventHandler(sender As Object, e As GiveFeedbackEventArgs)

매개 변수

sender
Object

이벤트 소스입니다.

e
GiveFeedbackEventArgs

이벤트 데이터를 포함하는 GiveFeedbackEventArgs입니다.

예제

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

또한이 사용자 지정 커서를 사용 하 여 끌어서 놓기 작업에 대 한 예제입니다. 이 예제에서는 두 개의 가정 커서 파일인 3dwarro.cur3dwno.cur, 사용자 지정 끌기에 대 한 애플리케이션 디렉터리에 있으며 놓기 없음 커서를 각각. 사용자 지정 커서를 사용할 경우는 UseCustomCursorsCheckCheckBox 확인란이 선택 되어 있습니다. 에 설정 된 사용자 지정 커서를 GiveFeedback 이벤트 처리기입니다.

키보드 상태에서 평가 되는 DragOver 오른쪽에 대 한 이벤트 처리기 ListBox결정 끌기 작업을 SHIFT, CTRL, ALT 또는 CTRL + ALT 키의 상태에 따라 합니다. 위치는 ListBox 하는 동안 결정 됩니다 드롭다운 수행 되는 DragOver 이벤트입니다. 데이터 삭제 없는 경우는 String, 해당 DragEventArgs.Effect 로 설정 된 DragDropEffects.None합니다. 드롭다운의 상태에 표시 됩니다는 마지막으로, 합니다 DropLocationLabelLabel합니다.

데이터를 오른쪽에 대 한 drop ListBox 에서 결정 됩니다는 DragDrop 이벤트 처리기 및 String 값에 적절 한 위치에 추가 됩니다는 ListBox. 끌기 작업 이동 폼의 범위를 벗어나는 경우에서 끌어서 놓기 작업이 취소 되는 QueryContinueDrag 이벤트 처리기입니다.

이 코드 예제를 사용 하 여 보여 줍니다.는 GiveFeedbackEventHandler 가진 대리자는 GiveFeedback 이벤트. 참조 된 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

설명

GiveFeedbackEventHandler 대리자를 만들 때, 이벤트를 처리할 메서드를 식별합니다. 이벤트를 이벤트 처리기와 연결하려면 대리자의 인스턴스를 해당 이벤트에 추가합니다. 대리자를 제거하지 않는 경우 이벤트가 발생할 때마다 이벤트 처리기가 호출됩니다. 대리자를 사용 하 여 이벤트를 처리 하는 방법에 대 한 자세한 내용은 참조 하세요. 이벤트 처리 및 발생합니다.

확장 메서드

GetMethodInfo(Delegate)

지정된 대리자가 나타내는 메서드를 나타내는 개체를 가져옵니다.

적용 대상

추가 정보