Dart.Emulation Namespace > Vt Class : KeyDown Event |
Public Shadows Event KeyDown As EventHandler(Of VtKeyEventArgs)
Dim instance As Vt Dim handler As EventHandler(Of VtKeyEventArgs) AddHandler instance.KeyDown, handler
public new event EventHandler<VtKeyEventArgs> KeyDown
public: new __event EventHandler<VtKeyEventArgs*>* KeyDown
public: new event EventHandler<VtKeyEventArgs^>^ KeyDown
The event handler receives an argument of type VtKeyEventArgs containing data related to this event. The following VtKeyEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Alt | (Inherited from System.Windows.Forms.KeyEventArgs) |
Control | (Inherited from System.Windows.Forms.KeyEventArgs) |
Extended | Returns true when the generating key is on an extended part of the keyboard. |
Handled | (Inherited from System.Windows.Forms.KeyEventArgs) |
KeyCode | (Inherited from System.Windows.Forms.KeyEventArgs) |
KeyData | (Inherited from System.Windows.Forms.KeyEventArgs) |
KeyValue | (Inherited from System.Windows.Forms.KeyEventArgs) |
Modifiers | (Inherited from System.Windows.Forms.KeyEventArgs) |
Shift | (Inherited from System.Windows.Forms.KeyEventArgs) |
SuppressKeyPress | (Inherited from System.Windows.Forms.KeyEventArgs) |
The KeyDown event is raised when a key is pressed and before the KeyPress event is raised. This event is useful for performing keymapping (mapping individual keys to any arbitrary character sequence). To do this, simply set e.Handled to true (notifying the Vt control that the key down was handled so the Vt control does not raise the KeyPress event) and send your own substituted character sequence.
private void vt1_KeyDown(object sender, Dart.Emulation.VtKeyEventArgs e) { //If there is a telnet connection if (telnet1.State != ConnectionState.Closed) { //Send substitute string when Control-H pressed if (e.Control && e.KeyCode == Keys.H) { e.Handled = true; //prevent other key events telnet1.Write("Hello World!"); } } }
Private Sub vt1_KeyDown(ByVal sender As Object, ByVal e As Dart.Emulation.VtKeyEventArgs) 'If there is a telnet connection If telnet1.State <> ConnectionState.Closed Then 'Send substitute string when Control-H pressed If e.Control AndAlso e.KeyCode = Keys.H Then e.Handled = True 'prevent other key events telnet1.Write("Hello World!") End If End If End Sub