ÈçºÎ×Ô¶¨ÒåÈý¸ö¼üµÄ×éºÏ¼ü
ÀûÓÃKeyDownʼþ£¬ÎÒÃǺÜÇáÒ׵ؾͿÉÒÔ±à³öÈóÌÐòÏìÓ¦Á½¸ö°´¼üµÄ×éºÏ¼üµÄʼþ£¬È磺Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) if Shift=1 and KeyCode=VbKeyM then msgbox "Äú°´ÏÂÁËShift+M¼ü" end if end sub Èç¹ûÒªÈóÌÐòÏìÓ¦Èý¸ö¼üµÄ×éºÏ¼ü¾ÍÒªÂé·³Ò»µã£¬±ÈÈçÏÖÔÚÒªÓÃshift+b+m´ò¿ª"²¿ÃÅ"´°Ìå¡£ Ê×ÏÈÒªÉùÃ÷Á½¸ö´°Ì弶±äÁ¿mSta/bSta±£´æM¼°B¼üµÄ°´¼ü״̬£¬È»ºóÔÚ´°ÌåµÄLoadʼþÀïÉèÖÃKeyPreview(¼üÔ¤ÀÀ)ΪTrue£¬ÒԱ㴰ÌåÏÈÓڿؼþ½ÓÊÕ¼üÅÌʼþ¡£ ÔÚKeyDownʼþÀïÅжϰ´¼ü£¬Èç¹û°´ÏÂM»òB£¬¾Í°ÑmSta»òbStaÖÃΪTrue¡£ ÔÚKeyUpʼþÀïÅжϰ´¼ü£¬Èç¹û·Å¿ªM»òB£¬¾Í°ÑmSta»òbStaÖÃΪfalse¡£ ×öÍêÕâЩʺó¾Í¿ÉÒÔÔÚKeyDownʼþÀïÅжÏÊÇ·ñ°´ÏÂÁËShift+M+B¼üÁË£¬´úÂêÈçÏ£º Dim mSta As Boolean Dim bSta As Boolean Private Sub Form_Load() Me.KeyPreview = True End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyM Then mSta = True End If If KeyCode = vbKeyb Then bSta = True End If If Shift = 1 And mSta = True And bSta = True Then DoCmd.OpenForm "²¿ÃÅ" mSta = False bSta = False End If End Sub Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyM Then mSta = False End If If KeyCode = vbKeyB Then bSta = False End If End Sub
--------------------------------------------------------------------------------
Ïà¹ØÎÄÕÂ
ûÓÐÏà¹ØÎÄÕÂ
|