GiveFeedbackEventArgs.UseDefaultCursors 속성
끌기 작업에서 끌어서 놓기 작업에 관련된 기본 커서를 사용해야 하는지 여부를 가져오거나 설정합니다.
네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)
구문
‘선언
Public Property UseDefaultCursors As Boolean
‘사용 방법
Dim instance As GiveFeedbackEventArgs
Dim value As Boolean
value = instance.UseDefaultCursors
instance.UseDefaultCursors = value
public bool UseDefaultCursors { get; set; }
public:
property bool UseDefaultCursors {
bool get ();
void set (bool value);
}
/** @property */
public boolean get_UseDefaultCursors ()
/** @property */
public void set_UseDefaultCursors (boolean value)
public function get UseDefaultCursors () : boolean
public function set UseDefaultCursors (value : boolean)
속성 값
기본 포인터가 사용되면 true이고, 그렇지 않으면 false입니다.
설명
시스템에서는 이동 또는 복사와 같은 다양한 끌어서 놓기 작업에 기본 끌어서 놓기 커서를 제공합니다. UseDefaultCursors가 false로 설정되면 이벤트 소스에서 적당한 커서를 설정해야 합니다.
예제
다음 예제에서는 두 개의 ListBox 컨트롤 간에 수행되는 끌어서 놓기 작업을 보여 줍니다. 다음 예제에서는 끌기가 시작될 때 DoDragDrop 메서드가 호출됩니다. MouseDown 이벤트가 발생하는 동안 마우스 위치로부터 SystemInformation.DragSize 이상 마우스를 이동하면 끌기 작업이 시작됩니다. IndexFromPoint 메서드는 MouseDown 이벤트가 발생하는 동안 끌어 올 항목의 인덱스를 확인하는 데 사용됩니다.
또한 다음 예제에서는 끌어서 놓기 작업에 대해 사용자 지정 커서를 사용하는 방법을 보여 줍니다. 다음 예제에서는 두 커서 파일, 즉 사용자 지정 끌기와 놓기 못함 커서에 대한 3dwarro.cur
및 3dwno.cur
가 각각 응용 프로그램 디렉터리에 있는 것으로 가정합니다. UseCustomCursorsCheck
CheckBox를 선택하면 사용자 지정 커서가 사용됩니다. 사용자 지정 커서는 GiveFeedback 이벤트 처리기에서 설정됩니다.
Shift, Ctrl, Alt 또는 Ctrl+Alt 중 끌기 작업을 수행하는 데 사용할 키 상태를 결정하기 위해 ListBox의 DragOver 이벤트 처리기에서 키보드 상태가 확인됩니다. DragOver 이벤트가 수행되는 동안 ListBox에서 끌어 놓기가 발생한 위치도 확인됩니다. 끌 데이터가 String이 아니면 DragEventArgs.Effect가 DragDropEffects.None으로 설정됩니다. 마지막으로 끌어 놓기 상태가 DropLocationLabel
Label에 표시됩니다.
오른쪽 ListBox에 놓을 데이터는 DragDrop 이벤트 처리기에서 결정되며 String 값은 ListBox의 적절한 위치에 추가됩니다. 끌기 작업이 폼의 범위를 벗어나면 QueryContinueDrag 이벤트 처리기에서 끌어서 놓기 작업이 취소됩니다.
인용된 이 코드에서는 GiveFeedbackEventArgs 클래스를 사용하는 방법을 보여 줍니다. 전체 코드 예제를 보려면 DoDragDrop 메서드를 참조하십시오.
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
private 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;
}
}
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,
System.Windows.Forms.GiveFeedbackEventArgs e)
{
// Use custom cursors if the check box is checked.
if (useCustomCursorsCheck.get_Checked()) {
// Sets the custom cursor based upon the effect.
e.set_UseDefaultCursors(false);
if ((e.get_Effect() & DragDropEffects.Move)
== DragDropEffects.Move) {
get_Cursor().set_Current(myNormalCursor);
}
else {
get_Cursor().set_Current(myNoDropCursor);
}
}
} //listDragSource_GiveFeedback
플랫폼
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원
참고 항목
참조
GiveFeedbackEventArgs 클래스
GiveFeedbackEventArgs 멤버
System.Windows.Forms 네임스페이스