Figyelem a billentyű lenyomást és a felengedést külön és egy biilentyű pufferbe írom az állapotát. Ez se a legszebb, de működik és tetszőlegesen módosítható. A primóba ez nem volt jó ott billentyű scant csináltam inkább.
Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 52 Then Bpuf(0) = Bpuf(0) Or 128
If KeyCode = 49 Then Bpuf(0) = Bpuf(0) Or 64
If KeyCode = 226 Then Bpuf(0) = Bpuf(0) Or 32
If KeyCode = 54 Then Bpuf(0) = Bpuf(0) Or 16
If KeyCode = 192 Then Bpuf(0) = Bpuf(0) Or 8
If KeyCode = 50 Then Bpuf(0) = Bpuf(0) Or 4
If KeyCode = 51 Then Bpuf(0) = Bpuf(0) Or 2
If KeyCode = 53 Then Bpuf(0) = Bpuf(0) Or 1
If KeyCode = 55 Then Bpuf(1) = Bpuf(1) Or 128
If KeyCode = 219 Then Bpuf(1) = Bpuf(1) Or 64
If KeyCode = 187 Then Bpuf(1) = Bpuf(1) Or 32
If KeyCode = 106 Then Bpuf(1) = Bpuf(1) Or 16
If KeyCode = 189 Then Bpuf(1) = Bpuf(1) Or 8
If KeyCode = 57 Then Bpuf(1) = Bpuf(1) Or 4
If KeyCode = 56 Then Bpuf(1) = Bpuf(1) Or 2
If KeyCode = 36 Then Bpuf(1) = Bpuf(1) Or 1
If KeyCode = 82 Then Bpuf(2) = Bpuf(2) Or 128
If KeyCode = 81 Then Bpuf(2) = Bpuf(2) Or 64
If KeyCode = 111 Then Bpuf(2) = Bpuf(2) Or 32
If KeyCode = 89 Then Bpuf(2) = Bpuf(2) Or 16
If KeyCode = 191 Then Bpuf(2) = Bpuf(2) Or 8
If KeyCode = 87 Then Bpuf(2) = Bpuf(2) Or 4
If KeyCode = 69 Then Bpuf(2) = Bpuf(2) Or 2
If KeyCode = 84 Then Bpuf(2) = Bpuf(2) Or 1
If KeyCode = 85 Then Bpuf(3) = Bpuf(3) Or 128
If KeyCode = 80 Then Bpuf(3) = Bpuf(3) Or 64
If KeyCode = 221 Then Bpuf(3) = Bpuf(3) Or 32
If KeyCode = 117 Then Bpuf(3) = Bpuf(3) Or 16
If KeyCode = 48 Then Bpuf(3) = Bpuf(3) Or 8
If KeyCode = 79 Then Bpuf(3) = Bpuf(3) Or 4
If KeyCode = 73 Then Bpuf(3) = Bpuf(3) Or 2
If KeyCode = 118 Then Bpuf(3) = Bpuf(3) Or 1
If KeyCode = 70 Then Bpuf(4) = Bpuf(4) Or 128
If KeyCode = 65 Then Bpuf(4) = Bpuf(4) Or 64
If KeyCode = 119 Then Bpuf(4) = Bpuf(4) Or 32
If KeyCode = 72 Then Bpuf(4) = Bpuf(4) Or 16
'If KeyCode = 111 Then Bpuf(4) = Bpuf(4) Or 8
If KeyCode = 83 Then Bpuf(4) = Bpuf(4) Or 4
If KeyCode = 68 Then Bpuf(4) = Bpuf(4) Or 2
If KeyCode = 71 Then Bpuf(4) = Bpuf(4) Or 1
If KeyCode = 74 Then Bpuf(5) = Bpuf(5) Or 128
If KeyCode = 186 Then Bpuf(5) = Bpuf(5) Or 64
If KeyCode = 220 Then Bpuf(5) = Bpuf(5) Or 32
If KeyCode = 13 Then Bpuf(5) = Bpuf(5) Or 16
If KeyCode = 222 Then Bpuf(5) = Bpuf(5) Or 8
If KeyCode = 76 Then Bpuf(5) = Bpuf(5) Or 4
If KeyCode = 75 Then Bpuf(5) = Bpuf(5) Or 2
If KeyCode = 8 Then Bpuf(5) = Bpuf(5) Or 1
If KeyCode = 86 Then Bpuf(6) = Bpuf(6) Or 128
If KeyCode = 90 Then Bpuf(6) = Bpuf(6) Or 64
If KeyCode = 20 Then Bpuf(6) = Bpuf(6) Or 32
If KeyCode = 78 Then Bpuf(6) = Bpuf(6) Or 16
If KeyCode = 16 Then Bpuf(6) = Bpuf(6) Or 8
If KeyCode = 88 Then Bpuf(6) = Bpuf(6) Or 4
If KeyCode = 67 Then Bpuf(6) = Bpuf(6) Or 2
If KeyCode = 66 Then Bpuf(6) = Bpuf(6) Or 1
If KeyCode = 77 Then Bpuf(7) = Bpuf(7) Or 128
If KeyCode = 109 Then Bpuf(7) = Bpuf(7) Or 64
If KeyCode = 32 Then Bpuf(7) = Bpuf(7) Or 32
If KeyCode = 17 Then Bpuf(7) = Bpuf(7) Or 16
If KeyCode = 35 Then Bpuf(7) = Bpuf(7) Or 8 'escape
If KeyCode = 190 Then Bpuf(7) = Bpuf(7) Or 4
If KeyCode = 188 Then Bpuf(7) = Bpuf(7) Or 2
If KeyCode = 116 Then Bpuf(7) = Bpuf(7) Or 1 'alt
'If KeyCode = 77 Then Bpuf(
= Bpuf(
Or 128
If KeyCode = 37 Then Bpuf(
= Bpuf(
Or 64 'up1
If KeyCode = 39 Then Bpuf(
= Bpuf(
Or 32 'down1
'If KeyCode = 17 Then Bpuf(
= Bpuf(
Or 16
If KeyCode = 112 Then Bpuf(
= Bpuf(
Or 8 ' fire1 / F1
If KeyCode = 40 Then Bpuf(
= Bpuf(
Or 4 'right1
If KeyCode = 38 Then Bpuf(
= Bpuf(
Or 2 'left1
If KeyCode = 45 Then Bpuf(
= Bpuf(
Or 1
'If KeyCode = 77 Then Bpuf(9) = Bpuf(9) Or 128
'If KeyCode = 37 Then Bpuf(9) = Bpuf(9) Or 64 'up2
'If KeyCode = 39 Then Bpuf(9) = Bpuf(9) Or 32 'down2
'If KeyCode = 17 Then Bpuf(9) = Bpuf(9) Or 16
'If KeyCode = 113 Then Bpuf(9) = Bpuf(9) Or 8 ' fire 2 / F2
'If KeyCode = 40 Then Bpuf(9) = Bpuf(9) Or 4 'right2
'If KeyCode = 38 Then Bpuf(9) = Bpuf(9) Or 2 ' left2
'If KeyCode = 45 Then Bpuf(9) = Bpuf(9) Or 1
End Sub
'**************************************************************
Private Sub Picture1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 52 Then Bpuf(0) = Bpuf(0) And 255 - 128
If KeyCode = 49 Then Bpuf(0) = Bpuf(0) And 255 - 64
If KeyCode = 226 Then Bpuf(0) = Bpuf(0) And 255 - 32
If KeyCode = 54 Then Bpuf(0) = Bpuf(0) And 255 - 16
If KeyCode = 192 Then Bpuf(0) = Bpuf(0) And 255 - 8
If KeyCode = 50 Then Bpuf(0) = Bpuf(0) And 255 - 4
If KeyCode = 51 Then Bpuf(0) = Bpuf(0) And 255 - 2
If KeyCode = 53 Then Bpuf(0) = Bpuf(0) And 255 - 1
If KeyCode = 55 Then Bpuf(1) = Bpuf(1) And 255 - 128
If KeyCode = 219 Then Bpuf(1) = Bpuf(1) And 255 - 64
If KeyCode = 187 Then Bpuf(1) = Bpuf(1) And 255 - 32
If KeyCode = 106 Then Bpuf(1) = Bpuf(1) And 255 - 16
If KeyCode = 189 Then Bpuf(1) = Bpuf(1) And 255 - 8
If KeyCode = 57 Then Bpuf(1) = Bpuf(1) And 255 - 4
If KeyCode = 56 Then Bpuf(1) = Bpuf(1) And 255 - 2
If KeyCode = 36 Then Bpuf(1) = Bpuf(1) And 255 - 1
If KeyCode = 82 Then Bpuf(2) = Bpuf(2) And 255 - 128
If KeyCode = 81 Then Bpuf(2) = Bpuf(2) And 255 - 64
If KeyCode = 111 Then Bpuf(2) = Bpuf(2) And 255 - 32
If KeyCode = 89 Then Bpuf(2) = Bpuf(2) And 255 - 16
If KeyCode = 191 Then Bpuf(2) = Bpuf(2) And 255 - 8
If KeyCode = 87 Then Bpuf(2) = Bpuf(2) And 255 - 4
If KeyCode = 69 Then Bpuf(2) = Bpuf(2) And 255 - 2
If KeyCode = 84 Then Bpuf(2) = Bpuf(2) And 255 - 1
If KeyCode = 85 Then Bpuf(3) = Bpuf(3) And 255 - 128
If KeyCode = 80 Then Bpuf(3) = Bpuf(3) And 255 - 64
If KeyCode = 221 Then Bpuf(3) = Bpuf(3) And 255 - 32
If KeyCode = 117 Then Bpuf(3) = Bpuf(3) And 255 - 16
If KeyCode = 48 Then Bpuf(3) = Bpuf(3) And 255 - 8
If KeyCode = 79 Then Bpuf(3) = Bpuf(3) And 255 - 4
If KeyCode = 73 Then Bpuf(3) = Bpuf(3) And 255 - 2
If KeyCode = 118 Then Bpuf(3) = Bpuf(3) And 255 - 1
If KeyCode = 70 Then Bpuf(4) = Bpuf(4) And 255 - 128
If KeyCode = 65 Then Bpuf(4) = Bpuf(4) And 255 - 64
If KeyCode = 119 Then Bpuf(4) = Bpuf(4) And 255 - 32
If KeyCode = 72 Then Bpuf(4) = Bpuf(4) And 255 - 16
'If KeyCode = 111 Then Bpuf(4) = Bpuf(4) and 255 -8
If KeyCode = 83 Then Bpuf(4) = Bpuf(4) And 255 - 4
If KeyCode = 68 Then Bpuf(4) = Bpuf(4) And 255 - 2
If KeyCode = 71 Then Bpuf(4) = Bpuf(4) And 255 - 1
If KeyCode = 74 Then Bpuf(5) = Bpuf(5) And 255 - 128
If KeyCode = 186 Then Bpuf(5) = Bpuf(5) And 255 - 64
If KeyCode = 220 Then Bpuf(5) = Bpuf(5) And 255 - 32
If KeyCode = 13 Then Bpuf(5) = Bpuf(5) And 255 - 16
If KeyCode = 222 Then Bpuf(5) = Bpuf(5) And 255 - 8
If KeyCode = 76 Then Bpuf(5) = Bpuf(5) And 255 - 4
If KeyCode = 75 Then Bpuf(5) = Bpuf(5) And 255 - 2
If KeyCode = 8 Then Bpuf(5) = Bpuf(5) And 255 - 1
If KeyCode = 86 Then Bpuf(6) = Bpuf(6) And 255 - 128
If KeyCode = 90 Then Bpuf(6) = Bpuf(6) And 255 - 64
If KeyCode = 20 Then Bpuf(6) = Bpuf(6) And 255 - 32
If KeyCode = 78 Then Bpuf(6) = Bpuf(6) And 255 - 16
If KeyCode = 16 Then Bpuf(6) = Bpuf(6) And 255 - 8
If KeyCode = 88 Then Bpuf(6) = Bpuf(6) And 255 - 4
If KeyCode = 67 Then Bpuf(6) = Bpuf(6) And 255 - 2
If KeyCode = 66 Then Bpuf(6) = Bpuf(6) And 255 - 1
If KeyCode = 77 Then Bpuf(7) = Bpuf(7) And 255 - 128
If KeyCode = 109 Then Bpuf(7) = Bpuf(7) And 255 - 64
If KeyCode = 32 Then Bpuf(7) = Bpuf(7) And 255 - 32
If KeyCode = 17 Then Bpuf(7) = Bpuf(7) And 255 - 16
If KeyCode = 35 Then Bpuf(7) = Bpuf(7) And 255 - 8 'escape
If KeyCode = 190 Then Bpuf(7) = Bpuf(7) And 255 - 4
If KeyCode = 188 Then Bpuf(7) = Bpuf(7) And 255 - 2
If KeyCode = 116 Then Bpuf(7) = Bpuf(7) And 255 - 1 'alt
'If KeyCode = 77 Then Bpuf(
= Bpuf(
and 255 -128
If KeyCode = 37 Then Bpuf(
= Bpuf(
And 255 - 64 'up1
If KeyCode = 39 Then Bpuf(
= Bpuf(
And 255 - 32 'down1
'If KeyCode = 17 Then Bpuf(
= Bpuf(
and 255 -16
If KeyCode = 112 Then Bpuf(
= Bpuf(
And 255 - 8 ' fire1 / F1
If KeyCode = 40 Then Bpuf(
= Bpuf(
And 255 - 4 'right1
If KeyCode = 38 Then Bpuf(
= Bpuf(
And 255 - 2 'left1
If KeyCode = 45 Then Bpuf(
= Bpuf(
And 255 - 1
'If KeyCode = 77 Then Bpuf(9) = Bpuf(9) and 255 -128
'If KeyCode = 37 Then Bpuf(9) = Bpuf(9) And 255 - 64 'up2
'If KeyCode = 39 Then Bpuf(9) = Bpuf(9) And 255 - 32 'down2
'If KeyCode = 17 Then Bpuf(9) = Bpuf(9) and 255 -16
'If KeyCode = 113 Then Bpuf(9) = Bpuf(9) And 255 - 8 ' fire 2 / F2
'If KeyCode = 40 Then Bpuf(9) = Bpuf(9) And 255 - 4 'right2
'If KeyCode = 38 Then Bpuf(9) = Bpuf(9) And 255 - 2 ' left2
'If KeyCode = 45 Then Bpuf(9) = Bpuf(9) and 255 -1
End Sub