试了真的不错,谢了。
CLEAR ALL CLOSE DATABASES ALL CLEAR goForm = CREATEOBJECT("C_Form") goForm.Show READ EVENTS CLOSE DATABASES ALL CLEAR ALL RETURN DEFINE CLASS C_Form AS Form Caption = "测试例程" MinWidth = 800 MinHeight = 600 AutoCenter = .T. KeyPreview = .T. ShowWindow = 2 && 注意:某些功能键在ShowWindow=0下是检测不到的 ADD OBJECT Edit1 AS EditBox ADD OBJECT Label1 AS Label WITH Caption = "", Height = 25, AutoSize = .T. PROCEDURE Arrange WITH ThisForm.Label1 .Top = ThisForm.Height - .Height - 5 .Left = 5 ENDWITH WITH ThisForm.Edit1 .Top = 5 .Left = 5 .Height = ThisForm.Label1.Top - .Top - 5 .Width = ThisForm.Width - .Left - 5 ENDWITH ENDPROC PROCEDURE Activate ThisForm.Arrange ENDPROC PROCEDURE Resize ThisForm.Arrange ENDPROC PROCEDURE KeyPress(tnKeyCode, tnShiftAltCtrl) IF tnKeyCode != 0x1B ThisForm.Label1.Caption = "所按键码:KeyCode = " + ALLTRIM(STR(tnKeyCode)) + " ShiftAltCtrl = " + ALLTRIM(STR(tnShiftAltCtrl)) ELSE RELEASE ThisForm ENDIF ENDPROC PROCEDURE Destroy CLEAR EVENTS ENDPROC ENDDEFINE