dragging line
-
hi,all how can i drag a line with mouse from a point to another and it is extended whenever i drag it with mouse thanx
-
hi,all how can i drag a line with mouse from a point to another and it is extended whenever i drag it with mouse thanx
If you want the line to disappear when the mouse is lifted, use the CreateGraphics method to draw it, otherwise you need to handle the paint event. Either way, you want to handle the mouse down, mouse move and mouse up events, you need to store the position where the mouse went down, and keep painting new lines from there to where they mouse is as you move it. What do you want to achieve ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
If you want the line to disappear when the mouse is lifted, use the CreateGraphics method to draw it, otherwise you need to handle the paint event. Either way, you want to handle the mouse down, mouse move and mouse up events, you need to store the position where the mouse went down, and keep painting new lines from there to where they mouse is as you move it. What do you want to achieve ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
hi, Christian i donot want it to disappear but tie two points (actually two images) and when i move image the line extended
-
hi, Christian i donot want it to disappear but tie two points (actually two images) and when i move image the line extended
What do you mean, two images ? What do you want to do ? If you want to draw two lines that persist, you need to handle the paint event, then when you call Invalidate(), the paint event will redraw your form. Store a bool to say if the mouse button is down, and two points, one for each end of the line. Set both to the current mouse pos when the mouse goes down, set one to the mouse position when it moves, and in your paint event, draw a line between them, if the mouse is down ( via that flag you set )
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
What do you mean, two images ? What do you want to do ? If you want to draw two lines that persist, you need to handle the paint event, then when you call Invalidate(), the paint event will redraw your form. Store a bool to say if the mouse button is down, and two points, one for each end of the line. Set both to the current mouse pos when the mouse goes down, set one to the mouse position when it moves, and in your paint event, draw a line between them, if the mouse is down ( via that flag you set )
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
thanx Christian about ur question iam making a mobile simulator project and i want to tie for example mobile node with base station node thanx alot generator
-
thanx Christian about ur question iam making a mobile simulator project and i want to tie for example mobile node with base station node thanx alot generator
OK, that's a little more complex, you need to then store the locations of 'objects' you want to draw lines between ( assuming you don't want to allow arbitrary lines to be drawn ).
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
OK, that's a little more complex, you need to then store the locations of 'objects' you want to draw lines between ( assuming you don't want to allow arbitrary lines to be drawn ).
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
( assuming you don't want to allow arbitrary lines to be drawn ). what is the mean of this generator
-
( assuming you don't want to allow arbitrary lines to be drawn ). what is the mean of this generator
You want lines to only be drawn between components, or just anywhere that people feel like it ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog