PictureBox with shortcut possible?

  • Thread starter Thread starter Mika M
  • Start date Start date
M

Mika M

My Windows Form (VB2005) contains PictureBox on it. This PictureBox has
click-event in use to do something. Now I need to know Is it possible to
set Shortcut for this PictureBox? I mean if user clicks for example "F2"
then it fires PictureBox_Click-event.
 
hi Mika

There is no way to be trace key press event with picture box but we
can handle it by another method.

You can do it by this method

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PictureBox1.Click
MessageBox.Show("Hello")
End Sub

Private Sub Form5_KeyUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
If e.KeyCode.F2 Then
PictureBox1_Click(sender, e)
End If
End Sub
 
Back
Top