I would like for a circle to be drawn with a piece of writing comming off it. I then want the circle to just move from say one side of a large label to halfway.
Seemed easy at first but now it seems a little harder. Please note i need to be able to click on this circle to bring up another form.
I am attempting to make a simple tracking system. A 2d map will be drawn, by which these circles represent people. When i click on the people, another form will show showing there details.
There are 20 people in the system, but i only need one moving.
It has been really useful, its what i wanted.
I am having trouble adapting the code to what i want, i was wondering if u cud help me.
I would like it to start from the right hand side, (not completly, bout a quarter in). Then move a little to the left and then move up.
I have been playing with the code, but find the program feezes. Here is the main form code for what i have.
I have left the second circle, as i want to get one working first.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
f1 = New Form2()
f1.Name = "John"
Me.AddOwnedForm(f1)
' f2 = New Form2()
' f2.Name = "Roy"
'Me.AddOwnedForm(f2)
Dim i As Integer
Dim startPoint As Integer = 120
Dim endPoint As Integer = 80
Dim stp As Integer = 1
While blnRunning
For i = startPoint To endPoint Step stp
f1.Left = Me.Right + i * 2
'f2.Top = Me.Top + i
Thread.Sleep(25)
Application.DoEvents()
If Not blnRunning Then
Exit For
End If
Next
If stp = 1 Then
stp = -1
startPoint = 80
endPoint = 120
Else
stp = 1
startPoint = 120
endPoint = 80
End If
End While
I worked out how to make the object move right to left and straight up. I am having a problem moving another object at the same time. Nothing happens, the object (named f8) doesnt move. Everything has been declared and boolean has been set to true. Do u know whats wrong? I am trying to get the object to move in a diagonal direction, ( i found that having a left and top does thi but its not working).
Dim i As Integer
Dim startPoint As Integer = 400
Dim endPoint As Integer = 200
Dim stp As Integer = 1
Dim start As Integer = 350
Dim ends As Integer = 200
While blnRunning
For i = startPoint To endPoint Step stp
f1.Left = Me.Left + i * 2
Thread.Sleep(25)
Application.DoEvents()
If Not blnRunning Then
Exit For
End If
Next
If stp = 1 Then
stp = -1
startPoint = 400
endPoint = 150
Else
stp = 1
blnRunning = False
bqrunning = True
End If
End While
While bqrunning
For i = start To ends Step stp
f1.Top = Me.Top + i
Thread.Sleep(25)
Application.DoEvents()
If Not bqrunning Then
Exit For
End If
Next
If stp = 1 Then
stp = -1
start = 350
ends = 160
Else
bqrunning = False
End If
End While
'f1.Close()
f1.Visible = True
f1.Top = Me.Top + i
f1.Left = Me.Left + 300
Dim s As Integer = 10
Dim en As Integer = 100
Dim t As Integer
While f8run
For t = s To en Step stp
f8.Left = Me.Left + t * 2
f8.Top = Me.Top + t
Thread.Sleep(25)
Application.DoEvents()
If Not f8run Then
Exit For
End If
Next
If stp = 1 Then
stp = -1
startPoint = 10
endPoint = 100
Else
f8run = False
I suggest that you single step through your program (start it by pressing the <F8> key and then keep pressing the <F8> key to go through line by line. If you hover the mouse pointer over the variable names during this process you will see their current values. This should help you see what is going wrong.
While you are debugging you can view and change variables in the Immediates window (press <CTRL> G to activate this. In this window type ?blnRunning to display the state of blnRunning, or type blnRunning = False to set it to false.
This world is not my home. I'm just passing through.
i have noticed that the while statement has from start to end stp.
That means it works between these points. The problem is i can't get another dot to move in a different location at the same time while the initial one is moving.
I need it in a different part of the screen and not the bounds set in the initial while statement.
The positions array holds 100 points for each Form2 object. f1's points are in positions(,0) and f2's points are in positions(,1). You don't have to use the For Next loop to populate positions - you could write 100 lines of code to create a different point for every element if you wanted.
VB Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
f1 = New Form2()
f1.Name = "John"
Me.AddOwnedForm(f1)
f2 = New Form2()
f2.Name = "Roy"
Me.AddOwnedForm(f2)
Dim positions(180, 2) As Point
Dim p As Integer
For p = 1 To 180
positions(p, 0) = New Point(p + 40 + Me.Left, p + 40 + Me.Top)
positions(p, 1) = New Point(2 * p + Me.Left, 100 + (Math.Sin(p / 10) * 80) + Me.Top)
Next p
f1.Visible = True
f1.Location = positions(1, 0)
f2.Visible = True
f1.Location = positions(1, 1)
Me.Visible = True
Dim i As Integer
Dim startPoint As Integer = 1
Dim endPoint As Integer = 180
Dim stp As Integer = 1
While blnRunning
For i = startPoint To endPoint Step stp
f1.Location = positions(i, 0)
f2.Location = positions(i, 1)
Thread.Sleep(25)
Application.DoEvents()
If Not blnRunning Then
Exit For
End If
Next
If stp = -1 Then
stp = 1
startPoint = 1
endPoint = 180
Else
stp = -1
startPoint = 180
endPoint = 1
End If
End While
f1.Close()
f2.Close()
End Sub
This world is not my home. I'm just passing through.
Rather than populating the positions array programatically you could write all your points in a CSV file (easily editted using Excel for example) and have your program read them in from this file.
This world is not my home. I'm just passing through.