0
我有一個項目,嘗試使一個酒吧跟隨我的鼠標左右使用計時器的圖片框。還需要考慮我考慮移動鼠標的速度。我試圖通過我的矩形做下面的代碼不會移動?爲什麼?DrawnObject不會隨着鼠標在計時器內移動
Dim p as rectangle
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles PictureBox1.Paint
Dim g As System.Drawing.Graphics
g = e.Graphics
Dim PaddleSize As New Size(50, 10)
Dim MystartingPoint As New Point(225, PictureBox1.Height - 50)
p = New Rectangle(MystartingPoint, PaddleSize)
g.FillRectangle(Brushes.OliveDrab, p)
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
p.Location = Me.PointToClient(New Point(MousePosition.X - 25, PictureBox1.Height - 50))
pictureBox1.refresh()
End Sub
您的編輯刪除了問題,所以我將其回滾。如果你試圖移動標籤,那將是一個不同的問題。 – LarsTech