filmov
tv
Visual Basic - #10 Über Form steuern (By XJC) [HD]
Показать описание
Public Class Form1
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Up Then
Form2.PictureBox1.Location = New Point(Form2.PictureBox1.Location.X - 0, Form2.PictureBox1.Location.Y - 10)
ElseIf e.KeyCode = Keys.Down Then
Form2.PictureBox1.Location = New Point(Form2.PictureBox1.Location.X + 0, Form2.PictureBox1.Location.Y + 10)
ElseIf e.KeyCode = Keys.Right Then
Form2.PictureBox1.Location = New Point(Form2.PictureBox1.Location.X + 10, Form2.PictureBox1.Location.Y + 0)
ElseIf e.KeyCode = Keys.Left Then
Form2.PictureBox1.Location = New Point(Form2.PictureBox1.Location.X - 10, Form2.PictureBox1.Location.Y - 0)
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form2.Show()
End Sub
End Class
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Up Then
Form2.PictureBox1.Location = New Point(Form2.PictureBox1.Location.X - 0, Form2.PictureBox1.Location.Y - 10)
ElseIf e.KeyCode = Keys.Down Then
Form2.PictureBox1.Location = New Point(Form2.PictureBox1.Location.X + 0, Form2.PictureBox1.Location.Y + 10)
ElseIf e.KeyCode = Keys.Right Then
Form2.PictureBox1.Location = New Point(Form2.PictureBox1.Location.X + 10, Form2.PictureBox1.Location.Y + 0)
ElseIf e.KeyCode = Keys.Left Then
Form2.PictureBox1.Location = New Point(Form2.PictureBox1.Location.X - 10, Form2.PictureBox1.Location.Y - 0)
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form2.Show()
End Sub
End Class