1.首先打开Form属性KeyPreview,并将值设置为True;
2.在Form的OnKeyDown事件中编写过程,其中
Key:Word 代表键值
Shift:TShiftState 代表Alt, Ctrl, and Shift以及鼠标
你可以使用Key=VK_F10来判断F10键,以次类推其他F1,F2...键,当然最直接的是使用数值来判断,
如:if Key=83 then ShowMessage('当前按下了S键');
提示:以上数值均为ASIIC码
附上Shift:TShiftState说明:
Value Meaning
ssShift The Shift key is held down.
ssAlt The Alt key is held down.
ssCtrl The Ctrl key is held down.
ssLeft The left mouse button is held down.
ssRight The right mouse button is held down.
ssMiddle The middle mouse button is held down.
ssDouble The mouse was double-clicked.
判断请使用Shift=[ssCtrl],以此类推;
-------------------------------------
按照你的说法,最好使用Form.ShowModal;来调用Form,你试试就知道效果了