private void ShowActiveFamily()
        {
            trace.TraceInformation("TreeViewPanel4::ShowActiveFamily (start) " + this.CanFocus);

            while (controlList.Count > 0)
            {
                Control ctrl = controlList[0];

                this.Controls.Remove(ctrl);
                ctrl.Dispose();

                controlList.RemoveAt(0);

                //ctrl.
            }
            selectedFamily = null;

            if (selectedIndividual != null)
            {
                //int pos = 0;
                System.Drawing.Point position = new Point(0, 0);

                int ctrlHeight = 0;

                {
                    IList <FamilyXrefClass> children = selectedIndividual.GetFamilyChildList();
                    //trace.TraceInformation("GetFamilyChildList");

                    if (children != null)
                    {
                        //trace.TraceInformation("Children.count = " + children.Count);
                        foreach (FamilyXrefClass childXref in children)
                        {
                            FamilyClass childFamily = new FamilyClass();
                            childFamily = familyTree.GetFamily(childXref.GetXrefName());
                            if (childFamily != null)
                            {
                                trace.TraceInformation(" parentFamily:" + childFamily.GetXrefName());

                                if (childFamily != null)
                                {
                                    if (childFamily.GetParentList() != null)
                                    {
                                        foreach (IndividualXrefClass parentXref in childFamily.GetParentList())
                                        {
                                            IndividualClass parent = new IndividualClass();

                                            parent = familyTree.GetIndividual(parentXref.GetXrefName());

                                            if (parent != null)
                                            {
                                                IndividualButton ctrl2 = new IndividualButton();
                                                //int position.Y = 0;

                                                if (ctrlHeight == 0)
                                                {
                                                    Label label = new Label();

                                                    label.Top  = position.Y;
                                                    label.Left = position.X;
                                                    label.Text = "Parents:";

                                                    this.Controls.Add(label);
                                                    controlList.Add(label);

                                                    position.Y += label.Height;
                                                }

                                                ctrl2.AutoSize = true;
                                                ctrl2.Left     = position.X;
                                                ctrl2.Top      = position.Y;
                                                //ctrl.Height = 100;
                                                //ctrl.Width = 400;
                                                ctrl2.Text = parent.GetName() + "\n" + parent.GetDate(IndividualEventClass.EventType.Birth).ToString() + " - " + parent.GetDate(IndividualEventClass.EventType.Death).ToString();
                                                trace.TraceInformation(" parent: AddControl:" + parent.GetName() + " X:" + position.X + " Y:" + position.Y + " Top:" + ctrl2.Top + " height:" + ctrl2.Height);
                                                ctrl2.FlatStyle  = FlatStyle.Flat;
                                                ctrl2.individual = parent;
                                                ctrl2.SetParent(this);

                                                ctrl2.Click += new System.EventHandler(ctrl2.Clicked);

                                                //ctrl2.Anchor = AnchorStyles.Left | AnchorStyles.Top;

                                                //ctrl.Height = 40;
                                                //ctrl.Width = 40;
                                                //ctrl.Show();

                                                controlList.Add(ctrl2);

                                                this.Controls.Add(ctrl2);

                                                position.X += ctrl2.Width;

                                                ctrlHeight = ctrl2.Height;
                                            }
                                            else
                                            {
                                                trace.TraceEvent(TraceEventType.Error, 0, "Error not a vaild person xref:" + parentXref.GetXrefName());
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                trace.TraceEvent(TraceEventType.Error, 0, "Error not a vaild person xref:" + childXref.GetXrefName());
                            }
                        }
                    }
                }

                if (ctrlHeight != 0)
                {
                    position.X  = 0;
                    position.Y += ctrlHeight;
                    position.Y += 20;

                    ctrlHeight = 0;
                }

                {
                    {
                        Label label = new Label();

                        label.Top  = position.Y;
                        label.Left = position.X;
                        label.Text = "Selected:";

                        this.Controls.Add(label);
                        controlList.Add(label);

                        position.Y += label.Height;
                    }
                    IndividualButton ctrl = new IndividualButton();

                    ctrl.AutoSize = true;
                    ctrl.Left     = position.X;
                    ctrl.Top      = position.Y;
                    //ctrl.Height = 100;
                    //ctrl.Width = 400;
                    ctrl.Text = selectedIndividual.GetName() + "\n" + selectedIndividual.GetDate(IndividualEventClass.EventType.Birth).ToString() + " - " + selectedIndividual.GetDate(IndividualEventClass.EventType.Death).ToString();

                    ctrl.Anchor    = AnchorStyles.Left | AnchorStyles.Top;
                    ctrl.FlatStyle = FlatStyle.Flat;
                    ctrl.Click    += new System.EventHandler(ctrl.Clicked);
                    ctrl.BackColor = Color.Beige;

                    ctrl.individual = selectedIndividual;
                    ctrl.SetParent(this);

                    trace.TraceInformation(" selected: AddControl:" + selectedIndividual.GetName() + " X:" + position.X + " Y:" + position.Y + " Top:" + ctrl.Top + " Height:" + ctrl.Height);
                    controlList.Add(ctrl);

                    this.Controls.Add(ctrl);

                    position.X += ctrl.Width;

                    ctrlHeight = ctrl.Height;
                }

                /*if (ctrlHeight != 0)
                 * {
                 * position.Y += 20;
                 * ctrlHeight = 0;
                 * }*/

                {
                    IList <FamilyXrefClass> spouseList = selectedIndividual.GetFamilySpouseList();

                    //trace.TraceInformation("GetFamilySpouseList()");
                    if (spouseList != null)
                    {
                        //trace.TraceInformation("spouses.count = " + spouseList.Count);
                        foreach (FamilyXrefClass spouseFamilyXref in spouseList)
                        {
                            FamilyClass spouseFamily = new FamilyClass();
                            spouseFamily = familyTree.GetFamily(spouseFamilyXref.GetXrefName());

                            //trace.TraceInformation("spouses.count s2=" + spouseFamilyXref.GetXrefName());
                            if (spouseFamily != null)
                            {
                                trace.TraceInformation(" spouseFamily:" + spouseFamily.GetXrefName());
                                //trace.TraceInformation("spouses.count s3 = " + spouseFamily);
                                if (selectedFamily == null)
                                {
                                    selectedFamily = spouseFamily;
                                }
                                //trace.TraceInformation("spouses.count s4 = ");
                                if (spouseFamily.GetParentList() != null)
                                {
                                    foreach (IndividualXrefClass spouseXref in spouseFamily.GetParentList())
                                    {
                                        //trace.TraceInformation("spouses.count s5 = ");
                                        if (spouseXref.GetXrefName() != selectedIndividual.GetXrefName())
                                        {
                                            IndividualClass spouse = new IndividualClass();

                                            spouse = familyTree.GetIndividual(spouseXref.GetXrefName());

                                            if (spouse != null)
                                            {
                                                IndividualButton ctrl2 = new IndividualButton();
                                                //int position.Y = 0;

                                                ctrl2.AutoSize = true;
                                                ctrl2.Left     = position.X;
                                                ctrl2.Top      = position.Y;

                                                ctrl2.Text = spouse.GetName() + "\r" + spouse.GetDate(IndividualEventClass.EventType.Birth).ToString() + " - " + spouse.GetDate(IndividualEventClass.EventType.Death).ToString();

                                                ctrl2.SetParent(this);


                                                ctrl2.FlatStyle  = FlatStyle.Flat;
                                                ctrl2.individual = spouse;
                                                ctrl2.Click     += new System.EventHandler(ctrl2.Clicked);

                                                controlList.Add(ctrl2);

                                                this.Controls.Add(ctrl2);
                                                //ctrl2.PerformLayout();
                                                position.X += ctrl2.Width;
                                                ctrlHeight  = ctrl2.Height;
                                                trace.TraceInformation(" spouse: AddControl:" + spouse.GetName() + " X:" + position.X + " Y:" + position.Y + " Top:" + ctrl2.Top + " Height:" + ctrl2.Height);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (ctrlHeight != 0)
                {
                    position.X  = 0;
                    position.Y += ctrlHeight;
                    position.Y += 20;
                    ctrlHeight  = 0;
                }
                if (selectedFamily != null)
                {
                    IList <IndividualXrefClass> childXrefList = selectedFamily.GetChildList();

                    trace.TraceInformation(" childFamily:" + selectedFamily.GetXrefName());
                    if (childXrefList != null)
                    {
                        foreach (IndividualXrefClass childXref in childXrefList)
                        {
                            IndividualClass child = new IndividualClass();

                            child = familyTree.GetIndividual(childXref.GetXrefName());

                            if (child != null)
                            {
                                if (ctrlHeight == 0)
                                {
                                    Label label = new Label();

                                    label.Top  = position.Y;
                                    label.Left = position.X;
                                    label.Text = "Children:";

                                    this.Controls.Add(label);
                                    controlList.Add(label);

                                    position.Y += label.Height;
                                }
                                IndividualButton ctrl2 = new IndividualButton();
                                //int position.Y = 0;

                                ctrl2.AutoSize  = true;
                                ctrl2.Left      = position.X;
                                ctrl2.Top       = position.Y;
                                ctrl2.FlatStyle = FlatStyle.Flat;
                                ctrl2.Click    += new System.EventHandler(ctrl2.Clicked);
                                //ctrl.Height = 100;
                                //ctrl.Width = 400;
                                ctrl2.Text       = child.GetName() + "\n" + child.GetDate(IndividualEventClass.EventType.Birth).ToString() + " - " + child.GetDate(IndividualEventClass.EventType.Death).ToString();
                                ctrl2.individual = child;
                                ctrl2.SetParent(this);

                                //ctrl2.Anchor = AnchorStyles.Left | AnchorStyles.Top;

                                //ctrl.Height = 40;
                                //ctrl.Width = 40;
                                //ctrl.Show();

                                controlList.Add(ctrl2);

                                this.Controls.Add(ctrl2);

                                trace.TraceInformation(" child: AddControl:" + child.GetName() + " X:" + position.X + " Y:" + position.Y + " Top:" + ctrl2.Top + " Height:" + ctrl2.Height);

                                position.Y += ctrl2.Height;
                                ctrlHeight += ctrl2.Height;
                            }
                        }
                    }
                }
            }
            this.Top  = 0;
            this.Left = 0;

            this.Width  = 600;
            this.Height = 600;


            //this.Show();

            trace.TraceInformation("TreeViewPanel4::ShowActiveFamily (end) ");
        }
 public void AddChildButton(IndividualButton button)
 {
     children.Add(button);
 }
 public void AddParentButton(IndividualButton button)
 {
     parents.Add(button);
 }