Please take a look at my code....
Help.....what is the problem with KeyUp? / . \
It didnt respon when i press & release the P button on keyboard>.<
P.S. i searched nearly ALL post in here......
Thanks~! >.<
Code:
Const WM_KEYDOWN As Integer = &H100 Const WM_SYSKEYDOWN As Integer = &H104 Const WM_KEYUP As Integer = &H101 Const WM_SYSKEYUP As Integer = &H105 Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean Dim XLocation As Integer = PictureBox2.Location.X Dim Ylocation As Integer = PictureBox2.Location.Y If ((msg.Msg = WM_KEYDOWN) Or (msg.Msg = WM_SYSKEYDOWN)) Then Select Case (keyData) Case Keys.W Me.Timer2.Start() Me.PictureBox2.SetBounds(XLocation, Ylocation - Me.ComboBox1.Text, 100, 100) If Me.PictureBox2.Top <= Me.PictureBox1.Top Then Ylocation = upbound Me.PictureBox2.SetBounds(XLocation, Me.PictureBox1.Top, 100, 100) End If Case Keys.A Me.PictureBox2.SetBounds(XLocation - Me.ComboBox1.Text, Ylocation, 100, 100) If Me.PictureBox2.Left <= Me.PictureBox1.Left Then Me.PictureBox2.SetBounds(Me.PictureBox1.Left, Ylocation, 100, 100) End If Case Keys.D Me.PictureBox2.SetBounds(XLocation + Me.ComboBox1.Text, Ylocation, 100, 100) If Me.PictureBox2.Right >= Me.PictureBox1.Right Then Me.PictureBox2.SetBounds(Me.PictureBox1.Right - 100, Ylocation, 100, 100) End If Case Keys.S Me.PictureBox2.SetBounds(XLocation, Ylocation + Me.ComboBox1.Text, 100, 100) If Me.PictureBox2.Bottom >= Me.PictureBox1.Bottom Then Me.PictureBox2.SetBounds(XLocation, Me.PictureBox1.Bottom - 100, 100, 100) End If End Select End If If ((msg.Msg = WM_KEYUP) Or (msg.Msg = WM_SYSKEYUP)) Then If keyData = Keys.P Then MessageBox.Show("hi") End If End If Return MyBase.ProcessCmdKey(msg, keyData) End Function
It didnt respon when i press & release the P button on keyboard>.<
P.S. i searched nearly ALL post in here......
Thanks~! >.<
Comment