About Checkiing Borders

liunx

Guest
I have a class containing a function called Moveup.However whenever i press the "up" button of the keyboard, the picture that i have, disappear out of the screen. Can any 1 help

Public Sub MoveUp(ByVal pnl As Panel)

Top -= INCR
If Height + Top >= pnl.Height Then
Top = pnl.Height - Top

End If

End Sub

Private Sub frmGame_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Up Then
bron.MoveUp(PnlGame)

End IfThe panel height should have nothing to do when you are pushing the up button since you are moving towards "Zero". Moving down would se the height.

Eric
 
Back
Top