|
-
Jun 12th, 2000, 04:59 PM
#1
Thread Starter
Hyperactive Member
I got the x and y coordinates of the pointer. How can i draw a line with that coordinates. I can´t use Direct draw ( sitting on a NT station). I have some idea of catching the movement in shootergames like Q3. Then i can compare it to other gamers. Good idea? Yeeeah!
-
Jun 12th, 2000, 07:15 PM
#2
Addicted Member
Assuming you have a Picture Box on your form:
Code:
Private Sub Picture1_Click()
Picture1.Scale (-10, 10)-(10, -10)
'Draw the X and Y Axis
Picture1.Line (0, -10)-(0, 10), QBColor(9)
Picture1.Line (-10, 0)-(10, 0), QBColor(12)
End Sub
-
Jun 12th, 2000, 08:26 PM
#3
Thread Starter
Hyperactive Member
The code u sent was creating a cross, thats good. But i´m not that good. Pleease specify! I have the x and y coordinates in pixels and i want to draw a line between each of this point. It is thousands of points.
-
Jun 13th, 2000, 12:48 AM
#4
Addicted Member
It did not create a cross, it created two lines one vertical
and one horizontal. The fact that they intersect in the middle of the picture box is a function of their x and y coordinates.
Code:
Picture1.Scale (-10, 10)-(10, -10)
'the syntax is Object.Line (x1, y1) - (x2, y2)
'where x1,y1 are the coordinates to start and x2,y2 are the
'final coordinates, so the following draws a horizontal line
'because x1 & y1 both equal zero
Picture1.Line (0, -10)-(0, 10), QBColor(9)
'and the following draws the vertical line
'it is centered because x2 and y2 are zero
Picture1.Line (-10, 0)-(10, 0), QBColor(12)
The Line Command only connects two points, to continue the line
to the next set of points the last set of the previous becomes the
first set of the next and so forth;
To draw a single line through a number of points you would have
to define the line or curve in the form of an equation and use the
Pset Method which in essence connects the dots defined by your x and y points.
Code:
For X = -10 To 20 Step 0.001
'Equation to Graph
Y = 2 * X ^ 2 + 5 * X - 4
Picture1.PSet (X, Y), QBColor(12) 'draw the dots
Next
Good Luck
-
Jun 13th, 2000, 01:20 AM
#5
Thread Starter
Hyperactive Member
Sorry!! I´ve got a bad day. I will try the code and come back to you. Thanx...
-
Jun 13th, 2000, 12:26 PM
#6
Thread Starter
Hyperactive Member
Thank u! I got it now! Yessss!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|