Flicker problem (looping)

vbSteve

New member
Joined
Jun 13, 2007
Messages
3
Programming Experience
5-10
Hi,

I'm trying to move around a circle on a Picturebox, which i called "myPictureBox". It works, though with a fast pulse flicker. I know that in VB6 you could put the AutoDraw of the picturebox to True to solve this, but VB .Net apperantly doesn't have this. (I recently made the switch to VB .NET)

I was wondering how it can be solved. The code is as followed (Simplified):

VB.NET:
Dim TaskManager As New class_taskmanager
Dim g As Graphics
Dim tPen As New Pen(Color.Blue, 1)
Dim x As Integer, y As Integer, w As Integer = 10, h As Integer = 10
Dim bRunning as Boolean = True

g = myPicBox.CreateGraphics()

While bRunning
 g.clear(Color.Black)

 bRunning = PlayerThink(x, y)  ' Return x, y for next position
 g.drawEllipse(tPen, x, y, w, h)
 TaskManager.WaitingTask(0.041, "seconds", true) ' Set to 24 Frames/Sec (1/24 = 0.041667) 
Wend



Many thanks in advance,
Steve
 
Back
Top