版权声明: https://blog.csdn.net/eds124/article/details/82315511
Public Class Form1
Private y As Integer = 900, x As Integer = 900, ky As Integer = 1000
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Dim k As Keys = e.KeyCode
If Keys.E = k And y > 0 Then
y -= 100
ElseIf Keys.D = k And y < 900 Then
y += 100
ElseIf Keys.S = k And x > 0 Then
x -= 100
ElseIf Keys.F = k And x < 1800 Then
x += 100
ElseIf Keys.K = k And ky > 800 Then
ky -= 200
ElseIf Keys.J = k And ky < 1000 Then
ky += 200
End If
Me.Refresh()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.BackColor = Color.Black
Me.WindowState = FormWindowState.Maximized
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim g As Graphics = e.Graphics
g.FillRectangle(Brushes.Red, x, y, 100, 100)
g.DrawRectangle(Pens.Blue, x + 45, 0, 10, y)
g.FillRectangle(Brushes.Pink, 0, ky, 1900, 200)
g.DrawString("对话", New Font("黑体", 50, FontStyle.Bold), Brushes.Blue, 0, ky)
g.DrawString("强度", New Font("黑体", 50, FontStyle.Bold), Brushes.Blue, 200, ky)
g.DrawString("装备", New Font("黑体", 50, FontStyle.Bold), Brushes.Blue, 400, ky)
g.DrawString("调查", New Font("黑体", 50, FontStyle.Bold), Brushes.Blue, 600, ky)
g.DrawString("乘降", New Font("黑体", 50, FontStyle.Bold), Brushes.Blue, 0, ky + 100)
g.DrawString("道具", New Font("黑体", 50, FontStyle.Bold), Brushes.Blue, 200, ky + 100)
g.DrawString("炮弹", New Font("黑体", 50, FontStyle.Bold), Brushes.Blue, 400, ky + 100)
g.DrawString("模式", New Font("黑体", 50, FontStyle.Bold), Brushes.Blue, 600, ky + 100)
End Sub
End Class