Hi, im trying to draw a family tree. i will try to tell the concept
heres the main data table
|ID | Name | ....| Spouse ID| Mother | Father |
________________________________________________
|p01 | Jhon | ....| p02 | | |
________________________________________________
|p02 | Mary | ....| P01 | | |
________________________________________________
|p03 |rachel| ....| | ps02 | ps01 |
________________________________________________
|p04 | paul | ....| p06 | ps02 | ps01
________________________________________________
|p05 |jenny | ....| | ps02 | ps01 |
________________________________________________
|p06 |sarah | ....| P04 | ps02 | ps01 |
________________________________________________
and i want my end result to be like
jhon ----- Mary
|
|
---------------------------------------
| | |
Rachel Paul --- Sarah Jenny
|
get the image?
so the logic im trying to use here is that first draw a box which has the text "jhon" then another box with the name "Mary" then connect the two boxes with a line in between and continue such....
Dim x As Integer = 30
Dim y As Integer = 30
Dim wid As Integer = 165
Dim hgt As Integer = 30
Dim cus As String = Nothing
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
For i = 0 To Me.FamilyDataSet1.Persons.Rows.Count - 1
e.Graphics.DrawRectangle(Pens.Black, x, y, wid, hgt)
Dim big_font As New Font("Comic Sans MS", 20, FontStyle.Bold, GraphicsUnit.Pixel)
e.Graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit
e.Graphics.DrawString(FamilyDataSet1.Persons.Rows(i).Item(1), big_font, Brushes.Black, x, y)
If cus = Nothing Then
Continue For
ElseIf cus = FamilyDataSet1.Persons.Rows(i).Item(8) Then
x += 60
Continue For
End If
cus = FamilyDataSet1.Persons.Rows(i).Item(8)
Next
Familydataset1 is the dataset used
Persons is the data table
'item(1) and item(8) refers to Name feild and the spouse id feild respectively
what i am trying to do here is after drawing the box check who is the spouse of jhon then draw the box for jhons spouse "mary" by increasing the x cordinate of the jhons rectangle
im stuck from there, rather its all a bit tangled and infact im stuck from the begining itself, please help me.
tanqsss in advance :)
heres a more detailed tree
[
^]