dcsimg
Results 1 to 4 of 4
  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2013
    Posts
    77

    Question A Visual Family Tree

    Hi everyone

    Having just successfully created a program that takes a GEDCOM file and converts it into pretty webpages I would not like to try something else.

    I don't even know whether this is possible using VB.net. I would like to make a program that allows me to drag people around on a family canvass and create links to parents/children automatically. A sort of visual family tree builder.

    2 question then:

    1. Is it possible with VB.net?
    2. Where do I start?

    I have never worked with clicking and dragging item around in a visual environment before so it's about time I started.

    Thanks for looking
    Penfound

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    4,447

    Re: A Visual Family Tree

    1. Anything you can program is possible with VB.net (and pretty much any other language you choose).

    2. Where you start depends on the approach you want to take.
    I'm just up because the dog needed to go out. It is the middle of the early morning (3 am, shouldn't be up for several hours yet), so I won't be sticking around to answer questions. Others will probably chime in later.

    Probably where you should start is deciding what information you want to store, and how you're going to store it and retrieve it. That seems more important to me than the graphical part. In particular, in addition to the family information would be some meta data defining where the control is located in some coordinate system and what the links are to other controls.
    You could have the user completely decide where to place controls relative to each other within the reference coordinate system and make the connections, or you just take the data and draw stuff hierarchically based on the hierarchy and the user could only move stuff around into "cells" or leafs of the hierarchy and the drawing would move other items around the moved item to maintain a tree type structure based on the connections rather than an arbitrary layout based on where the user moved things to.

    As for the graphical part, the question comes down to two approaches, I think.
    1. Use some existing controls, perhaps subclassing them to add dynamic dragging capability.
    2. Draw the graphical elements yourself instead of using controls.

    I've done some work creating a GUI that allowed users to create virtual Lan's represented by a certain colored rectangle, and then create port objects of a different color rectangle that can be connected to the various virtual lans (vlans) created. The user could choose the size and position of the virtual lan rectangles (along with a name to be displayed, a name to be used with the switch, and a description to be displayed when selected) and the size and position of the port objects along with the same names, and description information and keeping track of which vlan it is currently connected to. The user could easily click to connect a port to a vlan with the GUI and a connection line would be drawn between the rectangles. The user could drag any of the objects, ports or vlans, and all the connected lines would move to maintain the visual representation of the connections. The user could choose to connect the port to a different vlan, or disconnect it altogether from any vlan.

    Unfortunately, I don't have a generic version of that code that I could post, or a representative example (I don't think, although I may have done one in the past and have forgotten I've posted one).

    A different example of one way I've dragged pictureboxes around, representing cards for a card game, and then converted it to not use pictureboxes, but just drag drawn cards around (uses no controls, except possibly a single picturebox as the drawing surface, although I may be using the form for that, I don't remember).

    That would at least provide an example of one way to implement dragging a control around, or just dragging a rectangular area around and drawing the contents yourself. I assume it will be better than nothing. I know there are other examples on the forum of dragging shapes around on a form, so you might search for those, or the user who wrote the example may connect you, possibly before I finish this post, as I believe at least one such person is still quite active on this forum.
    Anyway, a link to the two versions of the card game can be found in this thread, post #6 (pictureboxes) and post #12 (no pictureboxes).
    Last edited by passel; Mar 6th, 2018 at 03:10 AM.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2013
    Posts
    77

    Re: A Visual Family Tree

    Thank you so much passel. You have given a place to start and look for more info as well the pointing out a sort of pathway. My data is already prepared and listed as individuals and families in the form of csv files. An answer like this at 3am is amazing!

  4. #4
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    4,447

    Re: A Visual Family Tree

    Quote Originally Posted by Penfound View Post
    ... An answer like this at 3am is amazing!
    Yes, well unfortunately sometimes I get a little too interested and time flies pretty quickly (its now after 5am and I'll probably not get back to sleep since I was thinking I wanted to get up a little before 6 and I'm almost there now).
    In this case, I searched back through my attachments to see if I happen to post an example of dragging rectangles around with connecting lines between them and didn't find any.

    I did find a couple of other dragging rectangle around examples I've posted.
    In this post, an example allowing dragging up to seven rectangles around a graph.
    You can left drag on the graph to move the whole image, or right drag on the graph to change scale.
    You can left drag on a rectangle to move it, right drag to change its size.
    http://www.vbforums.com/showthread.p...=1#post4756605

    Another example, allowing dragging and sizing rectangles using the same basic methods.
    In this case, the user wanted them numbered, and to be assigned to layers, so individual layers could be shown and manipulated independent of other layers.
    Click the button to create a layer. Numeric Up/Down to select a layer to "draw on".
    Shift-click with either mouse button to create a rectangle. If you use the right button with shift to create the button you can also drag at the same time to quickly size the button at the same time you create it.
    Ctrl-Click to delete a button. Deletes on button release (with Ctrl held down). If you don't want to delete, release Ctrl before releasing mouse button.
    http://www.vbforums.com/showthread.p...83#post5109683

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width


×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.