Example #1
0
        private void createAndFillAliasComboBox()
        {
            IMeasurements m = recursive;
            Panel         panelComboAliasInner = new Panel();

            panelComboAliasInner.Width  = panelComboAlias.Width;
            panelComboAliasInner.Height = 5;
            panelComboAlias.Controls.Add(panelComboAliasInner);
            int           y  = 0;
            List <string> al = new List <string>();

            recursive.GetAliases(al, null);
            Hashtable ea = recursive.ExternalAliases;

            for (int i = 0; i < m.Count; i++)
            {
                IMeasurement mea = m[i];
                char         c   = mea.Name[0];
                ComboBox     cb  = new ComboBox();
                panelComboAliasInner.Controls.Add(cb);
                aliasCombo[c] = cb;
                cb.Width      = 121;
                cb.Height     = 21;
                cb.Top        = 10 + y;
                cb.Left       = 10;
                Label l = new Label();
                panelComboAliasInner.Controls.Add(l);
                l.Text = c + "";
                l.Top  = cb.Top;
                l.Left = cb.Left + cb.Width + 10;
                foreach (string s in al)
                {
                    cb.Items.Add(s);
                }
                y += cb.Height + 10;
                if (ea == null)
                {
                    continue;
                }
                if (ea.ContainsKey(c))
                {
                    string str = ea[c] as string;
                    for (int j = 0; j < cb.Items.Count; j++)
                    {
                        if (str.Equals(cb.Items[j].ToString()))
                        {
                            cb.SelectedIndex = j;
                            break;
                        }
                    }
                }
            }
            panelComboAliasInner.Height = y;
        }