public bool IsEqual(TreeViewLayout layout) { if (layout == null) { return(false); } return((this.type == layout.type) && (this.GetGenerations() == layout.GetGenerations())); }
private void ShowActiveFamily() { bool clear = false; trace.TraceInformation("ShowActiveFamily (start)"); if (!this.CanFocus) { trace.TraceInformation("ShowActiveFamily (end:hidden->shown=>refresh)"); return; } if (generationNoCtrl.SelectedItem == null) { trace.TraceInformation("ShowActiveFamily (selecteditem == null)"); return; } if (generationNoCtrl.SelectedItem.ToString() != layout.GetGenerations().ToString()) { layout.SetGenerations(Convert.ToInt32(generationNoCtrl.SelectedItem)); } if (!layout.IsEqual(prevLayout)) { //lastSize.Height = this.Height; //lastSize.Width = this.Width; //layout.Init(lastSize); //ClearButtonLayout(); clear = true; prevLayout = layout.Clone(); } if (selectedIndividual != null) { if ((prevSelectedIndividual == null) || (prevSelectedIndividual != selectedIndividual.GetXrefName())) { //ClearButtonLayout(); clear = true; //prevLayout = layout; prevSelectedIndividual = selectedIndividual.GetXrefName(); } if (clear) { ClearButtonLayout(); trace.TraceData(TraceEventType.Warning, 0, " scrollv:" + mainPanel.VerticalScroll.Value + " " + mainPanel.VerticalScroll.Maximum + " " + mainPanel.VerticalScroll.Minimum + " scrollh:" + mainPanel.HorizontalScroll.Value + " " + mainPanel.HorizontalScroll.Maximum + " " + mainPanel.HorizontalScroll.Minimum); mainPanel.Width += 100; mainPanel.Height += 100; mainPanel.VerticalScroll.Value = mainPanel.VerticalScroll.Maximum; mainPanel.HorizontalScroll.Value = mainPanel.HorizontalScroll.Maximum; trace.TraceData(TraceEventType.Warning, 0, " scrollv:" + mainPanel.VerticalScroll.Value + " " + mainPanel.VerticalScroll.Maximum + " " + mainPanel.VerticalScroll.Minimum + " scrollh:" + mainPanel.HorizontalScroll.Value + " " + mainPanel.HorizontalScroll.Maximum + " " + mainPanel.HorizontalScroll.Minimum); } if (!personControlList.ContainsKey(selectedIndividual.GetXrefName())) { IndividualButton selectedButton = new IndividualButton(selectedIndividual.GetXrefName(), selectedIndividual); selectedButton.SetParent(this); personControlList.Add(selectedIndividual.GetXrefName(), selectedButton); mainPanel.Controls.Add(selectedButton); } IndividualButton personControl = personControlList[selectedIndividual.GetXrefName()]; UpdateIndividual(selectedIndividual, layout, ref personControl); CheckLayout(selectedIndividual.GetXrefName(), false); } else { if (prevSelectedIndividual != null) { ClearButtonLayout(); prevSelectedIndividual = null; } } //Refresh(); trace.TraceInformation("ShowActiveFamily (end-done) "); }
public AsyncTreePanel1() { scaleFactorVertical = (float)(0.0); personControlList = new Dictionary <string, IndividualButton>(); familyControlList = new Dictionary <string, FamilyButton>(); personThreadList = new Dictionary <string, FindPersonThread>(); familyThreadList = new Dictionary <string, FindFamilyThread>(); generationNoCtrl = new ComboBox(); layout = new TreeViewLayout(); for (int i = 9; i >= 2; i--) { generationNoCtrl.Items.Add(i.ToString()); } //generationNoCtrl.Font = new System.Drawing.Font("Segue UI", 9F); //scaleFactorVertical = (float)generationNoCtrl.Font.Height / (float)generationNoCtrl.Font.Size; generationNoCtrl.SelectedItem = layout.GetGenerations().ToString(); //generationNoCtrl.Width = (int)(40 * scaleFactorVertical); //generationNoCtrl.Height = (int)(generationNoCtrl.Font.Height * 1.5); font = new System.Drawing.Font("Segue UI", 9F); SetControlSize(generationNoCtrl, 25, font); //generationNoCtrl.SelectedItemChanged += GenerationNoCtrl_SelectedItemChanged; this.Controls.Add(generationNoCtrl); generationNoChange = new Button(); generationNoChange.Text = "Go"; generationNoChange.Left = generationNoCtrl.Right; //generationNoChange.Font = new System.Drawing.Font("Segue UI", 9F); //Debug.WriteLine("fontsize " + generationNoChange.Font.Height + " sz " + generationNoChange.Font.Size + " sz-pt " + generationNoChange.Font.SizeInPoints); //generationNoChange.Width = (int)(30 * scaleFactorVertical); generationNoChange.MouseClick += generationNoChange_MouseClick; //generationNoChange.Height = (int)(generationNoChange.Font.Height * 1.5); SetControlSize(generationNoChange, 20, font); this.Controls.Add(generationNoChange); /*Button check = new Button(); * check.Text = "Check"; * check.Left = generationNoChange.Right; * //check.Width = (int)(50 * scaleFactorVertical); * check.MouseClick += check_MouseClick; * //check.Font = new System.Drawing.Font("Segue UI", 9F); * //check.Height = (int)(check.Font.Height * 1.5); * SetControlSize(check, 40, font); * this.Controls.Add(check); */ /*Button force = new Button(); * force.Text = "Force"; * force.Left = check.Right; * //force.Width = (int)(50 * scaleFactorVertical); * force.MouseClick += force_MouseClick; * //force.Font = new System.Drawing.Font("Segue UI", 9F); * //force.Height = (int)(force.Font.Height * 1.5); * SetControlSize(force, 40, font); * this.Controls.Add(force); */ mainPanel = new Panel(); //mainPanel.VerticalScroll.Visible = true; //mainPanel.HorizontalScroll.Visible = true; mainPanel.AutoScroll = true; mainPanel.Dock = DockStyle.Fill; mainPanel.Top = generationNoCtrl.Bottom; //SetStyle(ControlStyles.FixedHeight | ControlStyles.FixedWidth, true); //ScrollBars = //AutoScroll = true; mainPanel.Font = font;// new System.Drawing.Font("Segue UI", 9F); this.Controls.Add(mainPanel); parentForm = null; trace.TraceInformation("AsyncTreePanel1::AsyncTreePanel1()"); handleNewIndividual = new HandleNewIndividual(HandleNewIndividual_Function); handleNewFamily = new HandleNewFamily(HandleNewFamily_Function); //this.VScroll = true; //this.HScroll = true; //SetStyle(ControlStyles.FixedHeight | ControlStyles.FixedWidth, true); //ScrollBars = //AutoScroll = true; this.Dock = DockStyle.Fill; updateDelay = null; this.VisibleChanged += TreeViewPanel_VisibleChanged; }