一:
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.Key==Key.Enter)
{
sendAppToServer();
}
base.OnKeyDown(e);
}
二;
下面为监听方向键:
protected override bool ProcessDialogKey(Keys keyData)
{
if (keyData == Keys.Up)
{
}
if (keyData == Keys.Down)
{
}
if (keyData == Keys.Left)
{
}
if (keyData == Keys.Right)
{
}
return base.ProcessDialogKey(keyData);
}