thrasher251
New member
- Joined
- Jun 10, 2010
- Messages
- 1
- Programming Experience
- Beginner
Hi, I'm creating a piece of software that uses a gps to draw a track of a car driving. The problem that im having is that i want the track to be relativly endless, and once it leaves the size of my bitmap (1000x1000) it is forgotten.
here is my current code, please help.
Dim old_x As Double
Dim old_y As Double
Private Sub drawline(ByVal runtime As Integer, ByVal new_x As Integer,_ ByVal new_y As Integer)
If runtime >= 1 Then
' Make the Bitmap and Graphics objects.
Dim wid As Integer = picGraph.ClientSize.Width
Dim hgt As Integer = picGraph.ClientSize.Height
Dim bm As New Bitmap(wid, hgt)
Dim gr As Graphics = Graphics.FromImage(bm)
Dim movex As Integer = new_x - old_x
Dim movey As Integer = new_y - old_y
If new_x = 0 Or new_y = 0 Or old_x = 0 Or old_y = 0 Then
movex = 0
movey = 0
Else
End If
gr.DrawImage(picGraph.Image, movex, movey)
'draw new line before starting again
gr.DrawLine(Pens.Black, wid \ 2, hgt \ 2, (wid \ 2) + movex, (hgt \_ 2) + movey)
' Display the result.
picGraph.Image = bm
picGraph.Refresh()
gr.Dispose()
old_x = new_x
old_y = new_y
End If
End Sub
here is my current code, please help.
Dim old_x As Double
Dim old_y As Double
Private Sub drawline(ByVal runtime As Integer, ByVal new_x As Integer,_ ByVal new_y As Integer)
If runtime >= 1 Then
' Make the Bitmap and Graphics objects.
Dim wid As Integer = picGraph.ClientSize.Width
Dim hgt As Integer = picGraph.ClientSize.Height
Dim bm As New Bitmap(wid, hgt)
Dim gr As Graphics = Graphics.FromImage(bm)
Dim movex As Integer = new_x - old_x
Dim movey As Integer = new_y - old_y
If new_x = 0 Or new_y = 0 Or old_x = 0 Or old_y = 0 Then
movex = 0
movey = 0
Else
End If
gr.DrawImage(picGraph.Image, movex, movey)
'draw new line before starting again
gr.DrawLine(Pens.Black, wid \ 2, hgt \ 2, (wid \ 2) + movex, (hgt \_ 2) + movey)
' Display the result.
picGraph.Image = bm
picGraph.Refresh()
gr.Dispose()
old_x = new_x
old_y = new_y
End If
End Sub