-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
KeyPressEventHandler.xml
71 lines (64 loc) · 4.9 KB
/
KeyPressEventHandler.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
71
<Type Name="KeyPressEventHandler" FullName="System.Windows.Forms.KeyPressEventHandler">
<TypeSignature Language="C#" Value="public delegate void KeyPressEventHandler(object sender, KeyPressEventArgs 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 KeyPressEventHandler extends System.MulticastDelegate" />
<TypeSignature Language="DocId" Value="T:System.Windows.Forms.KeyPressEventHandler" />
<TypeSignature Language="VB.NET" Value="Public Delegate Sub KeyPressEventHandler(sender As Object, e As KeyPressEventArgs)" />
<TypeSignature Language="F#" Value="type KeyPressEventHandler = delegate of obj * KeyPressEventArgs -> unit" />
<TypeSignature Language="C++ CLI" Value="public delegate void KeyPressEventHandler(System::Object ^ sender, KeyPressEventArgs ^ e);" />
<TypeSignature Language="C#" Value="public delegate void KeyPressEventHandler(object? sender, KeyPressEventArgs 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.KeyPressEventArgs" />
</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.KeyPressEventArgs" /> that contains the event data.</param>
<summary>Represents the method that will handle the <see cref="E:System.Windows.Forms.Control.KeyPress" /> event of a <see cref="T:System.Windows.Forms.Control" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Set <xref:System.Windows.Forms.KeyPressEventArgs.Handled%2A?displayProperty=nameWithType> to `true` to cancel the `KeyPress` event. This keeps the control from processing the key press.
When you create a <xref:System.Windows.Forms.KeyPressEventHandler> 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
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/KeyPressEventArgs/CPP/form1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/KeyPressEventArgs/Handled/form1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/KeyPressEventArgs/VB/form1.vb" id="Snippet1":::
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Control/KeyDown/form1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Control.KeyDown/VB/form1.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="M:System.Windows.Forms.Control.OnKeyPress(System.Windows.Forms.KeyPressEventArgs)" />
<altmember cref="E:System.Windows.Forms.Control.KeyPress" />
<altmember cref="T:System.Windows.Forms.KeyPressEventArgs" />
<altmember cref="M:System.Windows.Forms.Control.OnKeyDown(System.Windows.Forms.KeyEventArgs)" />
<altmember cref="E:System.Windows.Forms.Control.KeyDown" />
<altmember cref="M:System.Windows.Forms.Control.OnKeyUp(System.Windows.Forms.KeyEventArgs)" />
<altmember cref="E:System.Windows.Forms.Control.KeyUp" />
<altmember cref="T:System.Windows.Forms.KeyEventArgs" />
</Docs>
</Type>