|
-
January 31st, 2012, 08:44 PM
#1
Dag and drop graphed function or line
I need help. I have graphed an array. I would like to be able to have the user drag and drop ( using the mouse) the graphed function at runtime. I want to be able to see the graphed line move as the mouse moves it and stay in position when the mouse button is released. I would however like the option of keeping original data or saving the new one.
I have basic vb6 knowledge which I am keen to increase.
I can only find drag and drop for lists and databases.
My current thinking is to use GetCursorPosition& and when mouse is on a colored pixel for 4 secs retrieve the coordinate and compare (x and y value) it to the next position of the mouse. I could use a temp array to change the values of the function as the mouse moves.
This seems cumbersome.
Any ideas?
-
January 31st, 2012, 11:42 PM
#2
Re: Dag and drop graphed function or line
You'd have to do it all manually, unless you want to save an Image and copy that.
-
February 1st, 2012, 07:18 AM
#3
Re: Dag and drop graphed function or line
Right. Cut and Paste is available to controls, text, data and images.
What you'd actually have to do is like you thought. Make a copy of the array and call the plotting routine within the MouseMove() event while having "grapped" one point of the array.
You have to save the origin of the curve, the offset of the point the mouse grabbed in the MouseDown() event and compute new origins for plotting while moving.
While moving the curve you draw it inverted. If you have computed a new origin you draw it again inverted at the old position to remove it, then draw it at the new position to show it again.
It sounds complicated, but in fact works rather fast, depending on how complicated your drawing routine is.
Tags for this Thread
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
|