GiveFeedbackEventArgs クラス
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文
GiveFeedback イベントは、ドラッグ操作中に発生します。ドラッグ イベントのソースがマウス ポインタの外観を変更して、ドラッグ アンド ドロップ操作中にユーザーに視覚的フィードバックを与えることができます。GiveFeedbackEventArgs オブジェクトは、ドラッグ アンド ドロップ操作の種類と、既定のカーソルを使用するかどうかを指定します。
2 つの ListBox コントロールの間でドラッグ アンド ドロップ操作を実行する例を次に示します。この例では、ドラッグ アクションが開始したときに DoDragDrop メソッドが呼び出されます。ドラッグ操作は、MouseDown イベント実行中のマウス位置から SystemInformation.DragSize を超えてマウスが移動したときに開始されます。IndexFromPoint メソッドは、MouseDown イベントで、ドラッグする項目のインデックスを判別するために使用します。
この例では、ドラッグ アンド ドロップ操作でカスタム カーソルを使用する方法についても示します。この例では、2 つのカーソル ファイル (3dwarro.cur と 3dwno.cur) がアプリケーション ディレクトリ内に存在していることを想定しています。なお、それぞれのファイルはドラッグ用のカスタム カーソルとドロップなしのカスタム カーソルを表します。カスタム カーソルは、UseCustomCursorsCheckCheckBox がオンになっている場合に使用されます。カスタム カーソルは、GiveFeedback イベント ハンドラで設定されます。
キーボードの状態は、右側の ListBox の DragOver イベント ハンドラで評価されます。ドラッグ操作の内容は、Shift キー、Ctrl キー、Alt キー、または Ctrl + Alt キーの状態によって決まります。ドロップが発生する ListBox 内の位置は、DragOver イベント時にも判定されます。ドロップするデータが String でない場合は、DragEventArgs.Effect が DragDropEffects.None に設定されます。最後に、ドロップのステータスが DropLocationLabelLabel に表示されます。
右側の 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
System.EventArgs
System.Windows.Forms.GiveFeedbackEventArgs
プラットフォーム
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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
GiveFeedbackEventArgs コンストラクタ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文
Dim effect As DragDropEffects Dim useDefaultCursors As Boolean Dim instance As New GiveFeedbackEventArgs(effect, useDefaultCursors)
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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
GiveFeedbackEventArgs プロパティ
パブリック プロパティ
名前 | 説明 | |
---|---|---|
Effect | 表示されているドラッグ アンド ドロップ操作のフィードバックを取得します。 | |
UseDefaultCursors | ドラッグ操作において、ドラッグ アンド ドロップ効果に関連付けられている既定のカーソルを使用するかどうかを取得または設定します。 |
GiveFeedbackEventArgs メソッド
パブリック メソッド
名前 | 説明 | |
---|---|---|
Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) | |
GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) | |
GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) | |
ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) | |
ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |
名前 | 説明 | |
---|---|---|
Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) | |
MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |
GiveFeedbackEventArgs メンバ
ドラッグ操作中に発生する GiveFeedback イベントのデータを提供します。
GiveFeedbackEventArgs データ型で公開されるメンバを以下の表に示します。
パブリック コンストラクタ
パブリック プロパティ
名前 | 説明 | |
---|---|---|
Effect | 表示されているドラッグ アンド ドロップ操作のフィードバックを取得します。 | |
UseDefaultCursors | ドラッグ操作において、ドラッグ アンド ドロップ効果に関連付けられている既定のカーソルを使用するかどうかを取得または設定します。 |
名前 | 説明 | |
---|---|---|
Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) | |
GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) | |
GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) | |
ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) | |
ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |
名前 | 説明 | |
---|---|---|
Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) | |
MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |
- GiveFeedbackEventArgsのページへのリンク