Haii@all
also
wie kann ich prüfen ob eine picturebox den bildschirmrand berührt.
also ich habe
Topmost = true
Transparensykey = white
backcolor = white
picturebox1.image = gehender Mensch
so und wenn die picbox den linken rand berührt soll sie das bild ändern
Das ist der Code:
Nur leider funktioniert der nicht.
ps: timer 3 läuft immer
also
wie kann ich prüfen ob eine picturebox den bildschirmrand berührt.
also ich habe
Topmost = true
Transparensykey = white
backcolor = white
picturebox1.image = gehender Mensch
so und wenn die picbox den linken rand berührt soll sie das bild ändern
Das ist der Code:
VB.NET-Quellcode
- Public Class Form1
- Dim rectScr As New Rectangle
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- PictureBox1.Location = New Point(PictureBox1.Location.X + 50, PictureBox1.Location.Y)
- End Sub
- Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
- rectScr = Screen.PrimaryScreen.Bounds
- If PictureBox1.Left <= rectScr.Left Then
- Timer2.Stop()
- Timer1.Start()
- PictureBox1.Image = My.Resources.gehen_rechts
- End If
- If PictureBox1.Right <= rectScr.Right Then
- Timer1.Stop()
- Timer2.Start()
- PictureBox1.Image = My.Resources.gehen_links
- End If
- End Sub
- Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
- PictureBox1.Location = New Point(PictureBox1.Location.X - 50, PictureBox1.Location.Y)
- End Sub
- End Class
Nur leider funktioniert der nicht.
ps: timer 3 läuft immer
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „markushettmann“ ()