Graphic example - 'smart' connected graphic objects

Graphic example - 'smart' connected graphic objects

Post by Fantana N.L » Sun, 21 Nov 1999 04:00:00



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

 
 
 

Graphic example - 'smart' connected graphic objects

Post by Mike D Sutto » Sun, 21 Nov 1999 04:00:00


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

 
 
 

Graphic example - 'smart' connected graphic objects

Post by Oliver Keelin » Mon, 22 Nov 1999 04:00:00


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

 
 
 

1. Lines connecting graphic objects help?

I'm looking for a sample program that I saw somewhere and now can't
find.
The program showed how to put graphic objects on the screen and then
have a line connect to them.
It had something to do with a cashflow problem. e.g. Someone owes
someone else some money and that individual owned someone else more
money. At least that is what I remember.
Please give me the url to this if you can. Or anything similiar with
connecting different graphical objects with line sample code.
Thanks,
John

2. Sigh, More help with Mesa, Linux

3. Graphics Searcher for graphics on PC's?

4. Can I SHOWCASE from an Xterminal or SUN Console?

5. 'Blocky' graphics

6. PSP6 Crop to selection problems

7. 'Creative Graphics' suck

8. FreeHand vs. Illustrator vs. CorelDRAW8

9. X graphics libs for 'C' question

10. 'How to' graphics for green beginner

11. Info on 'Computer Graphics World'?

12. 'Graphics' Algorithms