Results 1 to 2 of 2

Thread: How to connect/link two shapes with polyline in the picturebox?

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2019
    Posts
    5

    How to connect/link two shapes with polyline in the picturebox?

    How to connect two shapes with polyline in the picturebox? and to assign the start point and end point snapped to my shapes? Also if I move the shapes, then the line at end and start can be moved belonging to the shapes as moving (shapes are Linked together by polyline)? it is part of scheme drawing project that I am demanding to make by VB.NET and Picturebox GDI+ Drawing.


    Is there any possibility for you to help doing this functionality by Code?


    Another Question?
    the following code is drawing polyline for array of points, how to end this polyline by an specific end point? by Code?

    Code:
    If points.Count > 1 Then
                e.Graphics.DrawLines(Pens.Black, points.ToArray())
    
            End If
    Many thanks!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: How to connect/link two shapes with polyline in the picturebox?

    First of all, I would recommend that you read the following, as well as the linked blog post:

    http://www.vbforums.com/showthread.php?588199

    What I would probably do in this case is start out by defining a type for each of your shapes as well as the lines. The lines would have properties for the shapes at each end and the shapes would have properties for each attached line. You may also need to store data about the nature of the attachment, e.g. a specific side. When a shape was moved, you could loop through all its attached lines and update them based on the new position of the shape.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width