|
<< Click to Display Table of Contents >> Enter - próximo campo |
![]() ![]()
|
Form.KeyPreview = true
private void Principal_KeyPress(object sender, KeyPressEventArgs e)
{
// enter não faz barulho
if ((byte)e.KeyChar == 13)
e.Handled = true;
}
private void Principal_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
// o controle atual é TextBox?
if (this.ActiveControl is TextBox) // então passa pro próximo
this.SelectNextControl(this.ActiveControl, !e.Shift, true, true, true);
}
// esc = techaus
if (e.KeyCode == Keys.Escape)
{
this.Close();
}
}