Graphic example - 'smart' connected graphic objects 
Author Message
 Graphic example - 'smart' connected graphic objects

Hallo,
I am looking for a simple VB example where I can link two rectangles
with a "smart" connection line. This should be such that when I move any
of rectangles the connectin line should stick on both rectangle objects.

(something similar to connecting 2 objectsin Power Point).

Thanks, Regards,
Nic



Wed, 08 May 2002 03:00:00 GMT  
 Graphic example - 'smart' connected graphic objects

Quote:
> Hallo,
> I am looking for a simple VB example where I can link two rectangles
> with a "smart" connection line. This should be such that when I move any
> of rectangles the connectin line should stick on both rectangle objects.

> (something similar to connecting 2 objectsin Power Point).

I don't know how your moving your boxes, but the simple way to draw a "smart
connection line" is to use the Line() function.
If you're two boes are called Picture1 and Picture2 then in the section of
code where you're dealing with the movement of these boxes (MouseMove ?) put
something like:

Line(Picture1.Left, Picture1.Top + (Picture1.Height / 2))-(Picture2.Left,
Picture2.Top + (Picture2.Height / 2))

Would draw a line from half way own the left side of the picture box, or:

Line(Picture1.Left + Picture1.Width, Picture1.Top + (Picture1.Height /
2))-(Picture2.Left + Picture2.Width, Picture2.Top + (Picture2.Height / 2))

Would draw a line from half way own the Right hand side.
You could probably check to see where abouts the two picture boxes are in
relation to each other to work out where you should draw the line between
them.
Hope this helps, let me know if you need more help,

    Mike



Wed, 08 May 2002 03:00:00 GMT  
 Graphic example - 'smart' connected graphic objects
When I have been doing stuff like this then I use Objects.  Then you can
have a collection that defines the elements of a group, then you move the
mouse, detect how far it has moved by comparing the X and Y values before
and after.  You then have a translate method in all your drawing objects.
You then call that method for each object in the Group Collection.
_____________________________________________________

Oliver Keeling
www.Keeling-net.co.uk
ICQ 5566220

Chaos, panic, & disorder - my work here is done.



Hallo,
I am looking for a simple VB example where I can link two rectangles
with a "smart" connection line. This should be such that when I move any
of rectangles the connectin line should stick on both rectangle objects.

(something similar to connecting 2 objectsin Power Point).

Thanks, Regards,
Nic



Thu, 09 May 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Graphic example - 'smart' connected graphic objects

2. Importing a graphic into a table's OLE object field

3. Bug in Graphics object's MeasureString method?

4. Scrolling 'larger than screen' graphics

5. Saving graphics objects to an standard graphics file

6. Visio's Graphic Filter

7. Word 2000 - Logo/Graphic Won't Print

8. I'm looking for card graphics

9. looking for example of Oracle's connective string for connecting to ASP

10. Help -- Trying to get around VB's lack of graphics capabilities

11. Change graphic's color in MouseUp

12. VB4.0 32 bits - Setup won't register graphics

 

 
Powered by phpBB® Forum Software