/
GiveFeedbackEventHandler.xml
70 lines (60 loc) · 6.44 KB
/
GiveFeedbackEventHandler.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<Type Name="GiveFeedbackEventHandler" FullName="System.Windows.Forms.GiveFeedbackEventHandler">
<TypeSignature Language="C#" Value="public delegate void GiveFeedbackEventHandler(object sender, GiveFeedbackEventArgs e);" FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed GiveFeedbackEventHandler extends System.MulticastDelegate" />
<TypeSignature Language="DocId" Value="T:System.Windows.Forms.GiveFeedbackEventHandler" />
<TypeSignature Language="VB.NET" Value="Public Delegate Sub GiveFeedbackEventHandler(sender As Object, e As GiveFeedbackEventArgs)" />
<TypeSignature Language="F#" Value="type GiveFeedbackEventHandler = delegate of obj * GiveFeedbackEventArgs -> unit" />
<TypeSignature Language="C++ CLI" Value="public delegate void GiveFeedbackEventHandler(System::Object ^ sender, GiveFeedbackEventArgs ^ e);" />
<TypeSignature Language="C#" Value="public delegate void GiveFeedbackEventHandler(object? sender, GiveFeedbackEventArgs e);" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Delegate</BaseTypeName>
</Base>
<Parameters>
<Parameter Name="sender" Type="System.Object">
<Attributes>
<Attribute FrameworkAlternate="windowsdesktop-8.0;windowsdesktop-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(2)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(2)>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
<Parameter Name="e" Type="System.Windows.Forms.GiveFeedbackEventArgs" />
</Parameters>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Docs>
<param name="sender">The source of the event.</param>
<param name="e">A <see cref="T:System.Windows.Forms.GiveFeedbackEventArgs" /> that contains the event data.</param>
<summary>Represents the method that handles the <see cref="E:System.Windows.Forms.Control.GiveFeedback" /> event of a <see cref="T:System.Windows.Forms.Control" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When you create a <xref:System.Windows.Forms.GiveFeedbackEventHandler> delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about handling events with delegates, see [Handling and Raising Events](/dotnet/standard/events/).
## Examples
The following example demonstrates a drag-and-drop operation between two <xref:System.Windows.Forms.ListBox> controls. The example calls the <xref:System.Windows.Forms.Control.DoDragDrop%2A> method when the drag action starts. The drag action starts if the mouse has moved more than <xref:System.Windows.Forms.SystemInformation.DragSize%2A?displayProperty=nameWithType> from the mouse location during the <xref:System.Windows.Forms.Control.MouseDown> event. The <xref:System.Windows.Forms.ListBox.IndexFromPoint%2A> method is used to determine the index of the item to drag during the `MouseDown` event.
The example also demonstrates using custom cursors for the drag-and-drop operation. The example assumes that two cursor files, `3dwarro.cur` and `3dwno.cur`, exist in the application directory, for the custom drag and no-drop cursors, respectively. The custom cursors will be used if the `UseCustomCursorsCheck` <xref:System.Windows.Forms.CheckBox> is checked. The custom cursors are set in the <xref:System.Windows.Forms.Control.GiveFeedback> event handler.
The keyboard state is evaluated in the <xref:System.Windows.Forms.Control.DragOver> event handler for the right `ListBox`, to determine what the drag operation will be based upon state of the SHIFT, CTRL, ALT, or CTRL+ALT keys. The location in the `ListBox` where the drop would occur is also determined during the `DragOver` event. If the data to drop is not a `String`, then the <xref:System.Windows.Forms.DragEventArgs.Effect%2A?displayProperty=nameWithType> is set to <xref:System.Windows.Forms.DragDropEffects.None?displayProperty=nameWithType>. Finally, the status of the drop is displayed in the `DropLocationLabel` <xref:System.Windows.Forms.Label>.
The data to drop for the right `ListBox` is determined in the <xref:System.Windows.Forms.Control.DragDrop> event handler and the `String` value is added at the appropriate place in the `ListBox`. If the drag operation moves outside the bounds of the form, then the drag-and-drop operation is canceled in the <xref:System.Windows.Forms.Control.QueryContinueDrag> event handler.
This code excerpt demonstrates using the <xref:System.Windows.Forms.GiveFeedbackEventHandler> delegate with the <xref:System.Windows.Forms.Control.GiveFeedback> event. See the <xref:System.Windows.Forms.Control.DoDragDrop%2A> method for the complete code example.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.DoDragDrop/CPP/form1.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Control/DoDragDrop/form11.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Control.DoDragDrop/VB/form1.vb" id="Snippet3":::
]]></format>
</remarks>
<altmember cref="M:System.Windows.Forms.Control.OnGiveFeedback(System.Windows.Forms.GiveFeedbackEventArgs)" />
<altmember cref="E:System.Windows.Forms.Control.GiveFeedback" />
<altmember cref="T:System.Windows.Forms.GiveFeedbackEventArgs" />
</Docs>
</Type>