TabControlArray.KeyPress 事件

定义

当焦点在控件上按下键时发生。Occurs when a key is pressed and the control has focus.

public:
 event System::Windows::Forms::KeyPressEventHandler ^ KeyPress;
public event System.Windows.Forms.KeyPressEventHandler KeyPress;
member this.KeyPress : System.Windows.Forms.KeyPressEventHandler 
Public Custom Event KeyPress As KeyPressEventHandler 
Public Event KeyPress As KeyPressEventHandler 

事件类型

KeyPressEventHandler

注解

键事件按以下顺序发生:Key events occur in the following order:

KeyDown

KeyPress

KeyUp

KeyPress非字符键不引发该事件; 但是,非字符键会引发 KeyDownKeyUp 事件。The KeyPress event is not raised by noncharacter keys; however, the noncharacter keys do raise the KeyDown and KeyUp events.

使用 KeyChar 属性在运行时采样击键,并使用或修改一小部分击键。Use the KeyChar property to sample keystrokes at run time and to consume or modify a subset of common keystrokes.

若要仅在窗体级别处理键盘事件,而不允许控件接收键盘事件,请将 Handled 窗体的事件处理方法中的属性设置 KeyPresstrueTo handle keyboard events only at the form level and not enable controls to receive keyboard events, set the Handled property in the form's KeyPress event-handling method to true.

有关如何处理事件的详细信息,请参阅 处理和引发事件For more information about how to handle events, see Handling and Raising Events.

备注

Microsoft.VisualBasic.Compatibility.VB6 命名空间中的函数和对象用于工具从 Visual Basic 6.0 升级到 Visual Basic。Functions and objects in the Microsoft.VisualBasic.Compatibility.VB6 namespace are provided for use by the tools for upgrading from Visual Basic 6.0 to Visual Basic. 多数情况下,这些函数和对象可再现 .NET Framework 中其他命名空间的功能。In most cases, these functions and objects duplicate functionality that you can find in other namespaces in the .NET Framework. 只有当 Visual Basic 6.0 代码模型与 .NET Framework 实现有显著区别时,才必须使用这些函数和对象。They are necessary only when the Visual Basic 6.0 code model differs significantly from the .NET Framework implementation.

适用于

另请参阅