有時(shí)我們?cè)诓僮鞒绦驎r(shí),想在按下回車鍵時(shí)就使下一個(gè)控件獲得焦點(diǎn)而不是通過(guò)點(diǎn)擊鼠標(biāo)或按下TAB鍵實(shí)現(xiàn)。其具體原理比較簡(jiǎn)單,即當(dāng)用戶按下回車鍵時(shí)(KeyAscii為13),通過(guò)Send模擬按下一個(gè)Tab鍵即可。具體源代碼如下:
Private Sub Text1_KeyPress (KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys “{tab}”
KeyAscii = 0
End If
End Sub
新聞熱點(diǎn)
疑難解答