Label Location

  • VB.NET

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von FunnySunny.

    Label Location

    Hallo
    Ich komm nicht mehr weiter
    Ich Versuche die ganze zeit das wen label1 auf location 35;15 drauf ist das label2 dann grün leuchtet
    Ich habe es schon geschaft das ich label1 mit den Pfeiltesten bewegen kann aber
    ich weis nicht was ich eingeben muss wenn es auf Location 35;15 ist

    VB.NET-Quellcode

    1. ​Public Class Form1
    2. Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    3. If e.KeyCode = Keys.Down Then
    4. Dim new_location As Point = New Point(Label2.Location.X, Label2.Location.Y + 10)
    5. Label2.Location = new_location
    6. End If
    7. If e.KeyCode = Keys.Up Then
    8. Dim new_location As Point = New Point(Label2.Location.X, Label2.Location.Y - 10)
    9. Label2.Location = new_location
    10. End If
    11. If e.KeyCode = Keys.Right Then
    12. Dim new_location As Point = New Point(Label2.Location.X + 10, Label2.Location.Y)
    13. Label2.Location = new_location
    14. End If
    15. If e.KeyCode = Keys.Left Then
    16. Dim new_location As Point = New Point(Label2.Location.X - 10, Label2.Location.Y)
    17. Label2.Location = new_location
    18. End If
    19. End Sub