按键响应
我的Form上有个按键 当我按下enter的时候 应该是enabled的 代码是这样
void __fastcall TForm1::Button1KeyPress(TObject *Sender, char &Key)
{
if(Key==0x1d)
{Form1->Button1->Enabled=false;}
}
我在Form1中的activecontrol设置为 button1
enter是不行 但是我设置key的值为100('d')或者数字键的时候 是可以的 为什么enter不响应呢?
[解决办法]
使用KeyDown事件试试
void __fastcall TForm1::Button1KeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
}
Shift取值如下:
ssShiftThe Shift key is held down.
ssAltThe Alt key is held down.
ssCtrlThe Ctrl key is held down.
ssLeftThe left mouse button is held down.
ssRightThe right mouse button is held down.
ssMiddleThe middle mouse button is held down.
ssDoubleThe mouse was double-clicked.