private void fill(Panel p, bool b) { int k = b ? 0 : 1; int[,] num = selection.Numbers; int n = num[k, 0]; int m = num[k, 1]; IList <IStructuredSelectionCollection> l = selection.Selections; int y = 0; for (int i = 0; i < l.Count; i++) { IStructuredSelectionCollection coll = l[i]; CategoryTheory.IAssociatedObject ao = coll as CategoryTheory.IAssociatedObject; IObjectLabel lab = ao.Object as IObjectLabel; UserControlObject op = new UserControlObject(null, lab); op.Left = 0; op.Top = y; p.Controls.Add(op); y = op.Bottom + 5; int nSel = coll.Count; for (int j = 0; j < nSel; j++) { IStructuredSelection sel = coll[j]; RadioButton rb = new RadioButton(); rb.CheckedChanged += radioButtonSel_CheckedChanged; rb.Text = sel.Name; rb.Tag = new object[] { coll, j, b }; if (n == i & m == j) { rb.Checked = true; } rb.Left = 5; rb.Top = y; p.Controls.Add(rb); y = rb.Bottom + 5; } Panel bl = new Panel(); bl.BackColor = Color.Black; bl.Width = p.Width - 10; bl.Left = 0; bl.Top = y; bl.Height = 2; p.Controls.Add(bl); y = bl.Bottom + 5; } }
/// <summary> /// Costructor /// </summary> /// <param name="reg">Regression component</param> /// <param name="s">Selection</param> public RegressionSelectionUserControl(AliasRegression reg, IStructuredSelectionCollection s) : this() { this.s = s; this.reg = reg; IAssociatedObject ao = s as IAssociatedObject; IObjectLabel label = ao.Object as IObjectLabel; name = label.RootName;//NamedComponent.GetText(label); Control c = new UserControlObject(null, label); c.Left = 0; c.Top = 0; Controls.Add(c); int y = c.Height; for (int i = 0; i < s.Count; i++) { IStructuredSelection sel = s[i]; Label l = new Label(); l.Text = sel.Name; l.Top = y + 10; l.Left = 10; Controls.Add(l); y = l.Top + l.Height; NumericUpDown n = new NumericUpDown(); n.Minimum = -1; n.Value = -1; n.Left = 10; n.Top = y + 10; y = n.Top + n.Height + 20; Controls.Add(n); controls[n] = reg.GetRelativeName(s as IAssociatedObject) + "." + sel.Name; } Height = y; }