Ok, I don t know VBA6 but, since you said:
I don t think it matters what I do it in
我将提出一个通用的解决办法,涉及你们的圈子和线端点。
这条线可视为病媒:
(line.x2-line.x1, line.y2-line.y1)
You don t need to write this in your program or anything just saying it is a vector.
What you do need to is get the magnitude of the vector and assign it to a variable:
unitSize = sqrt((line.x2-line.x1)^2 + (line.y2-line.y1)^2)
如今,它已成为病媒的单位组成部分,并具有单独的构成部分:
unitX = (line.x2-line.x1)/unitSize
unitY = (line.y2-line.y1)/unitSize
Now how ever you update the circle:
do {
circle.x = circle.x + unitX * incrementSize //incrementSize scales how big the movement is assign it to whatever you seem fit.
circle.y = circle.y + unitY * incrementSize
until (circle.x >= line.x2) //Or <= line.x2 depends which way you are going.
Hopefully this helps.