Soyez le premier à donner votre avis sur cette source.
Snippet vu 2 997 fois - Téléchargée 3 fois
'------------------------------ Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Boolean Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) '------------------------------ Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Form_KeyPress (KeyCode) End Sub '------------------------------ Private Sub Form_KeyPress(KeyAscii As Integer) With Form1 LineC.X1 = .Width / 2 LineC.Y1 = .Height / 2 LineC.X2 = (.Width / 2) + IIf(GetAsyncKeyState(37), 0, .Width / 2) - IIf(GetAsyncKeyState(39), 0, .Width / 2) LineC.Y2 = (.Height / 2) + IIf(GetAsyncKeyState(38), 0, .Height / 2) - IIf(GetAsyncKeyState(40), 0, .Height / 2) End With DoEvents Sleep 100 With Form1 LineC.X1 = .Width / 2 LineC.X2 = .Width / 2 LineC.Y1 = .Height / 2 LineC.Y2 = .Height / 2 End With DoEvents End Sub '------------------------------ Private Sub Form_Load() LineC.BorderColor = vbRed LineC.BorderWidth = 10 KeyPreview = True With Form1 Line2.X1 = 0 Line2.Y1 = .Height / 2 Line2.X2 = .Width Line2.Y2 = .Height / 2 Line1.X1 = .Width / 2 Line1.Y1 = 0 Line1.X2 = .Width / 2 Line1.Y2 = .Height LineC.X1 = .Width / 2 LineC.X2 = .Width / 2 LineC.Y1 = .Height / 2 LineC.Y2 = .Height / 2 End With End Sub
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.