2014-01-05
展开全部
重写窗体的ProcessCmdKey:
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
Select Case keyData
Case Keys.F1
MessageBox.Show("F1")
Me.Button1.PerformClick()
Case Keys.F2
MessageBox.Show("F2")
Button2_Click(Nothing, Nothing)
Case Keys.F4
MessageBox.Show("F4")
Me.Close()
End Select
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
Select Case keyData
Case Keys.F1
MessageBox.Show("F1")
Me.Button1.PerformClick()
Case Keys.F2
MessageBox.Show("F2")
Button2_Click(Nothing, Nothing)
Case Keys.F4
MessageBox.Show("F4")
Me.Close()
End Select
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询