Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

How to refresh graphics when it's moving around?

Say for example I draw a box on my screen. The box's X and Y coord will change pretty much all the time. When I am drawing the box and all of it's new position, a new box keeps appearing. I want to draw the same box, and as its location is changed, draw that same box on the new location.

Example :

Box1 : X/Y = 0,0 Box1 (new X/Y) = 0,15

I now have 2 box on my screen.

Dim doo As Integer = 1

Code
While doo = 1
    For i As Integer = 0 To MonsterCount
        Dim xx As Integer = GetPrivateProfileInt("iPC=" & i, "X-Int:", 0, INI)
        Dim yy As Integer = GetPrivateProfileInt("iPC=" & i, "Y-Int:", 0, INI)
        Box(i) = New Box(xx, yy)

        If Box(i).x > -10 And Box(i).y > -10 And Box(0).x <= 1920 And Box(0).y <= 1080 Then
            Dim rect As New Rectangle(Box(i).x, Box(i).y, 120, 80)
            e.Graphics.DrawRectangle(Pens.Green, rect)
            Invalidate()
        End If

    Next i

    Threading.Thread.Sleep(5)
End While

Thank you for any help!
You keep making a new instance of rectangle on your code.
[Image: signaturetwo.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by ClockismApr 16, 2018 11:03 AM 3 122 Apr 16, 2018 11:03 AM
Last Post: Clockism
[Shell] by CitrusllJun 7, 2017 02:55 AM 4 173 Jun 7, 2017 02:55 AM
Last Post: Citrusll
[C#] by AseeraaJan 15, 2017 04:15 PM 1 113 Jan 15, 2017 04:15 PM
Last Post: GuRuHaX