Click to See Complete Forum and Search --> : rag and drop of a line


nekm
July 23rd, 2000, 05:39 PM
How do I enable creating, dragging and dropping of a line on a form? (Exactly as one can do in the VB editor when one puts the line control on a form). The line control does not have a dragmode property!

raghu_nv
July 24th, 2000, 01:12 AM
I can give you some hints.
1. Create a toolbar and Load an image that looks like a line into a button of toolbar
2. In VB IDE Create a line with index property = 0 and visible = 0 Name = Ln.(At run Time use this line as temporary line to show when dragging and dropping.
3. Allow the user to create lines by drag and drop methods only when line button is clicked in toolbar
4. Use Form_MouseDown event to capture the clicked point and set ln(0).x1=x , ln(0).x2=x , ln(0).y1=y , ln(0).y2=y and ln(0).visible=true.
5. In the Form_MouseMove event set ln(0).x2=x and ln(0).y2=y
6 In Form_MouseUp event load a new line into line array and copy properties of ln(0) to the new line and give ln(0).visible= false