Пример #1
0
        public static void fillCombo(xList fldData, ComboBox frmField, int chosenIdx = 0, bool useTitle = true, bool inclParmData = false)
        {
            int selIdx = 0;

            if (useTitle)
            {
                frmField.Items.Add(fldData.Title);
            }
            else
            {
                chosenIdx--;
            }
            //if (fldData.hasSubList) {
            //    frmField.SelectedIndexChanged += Combo_SelectedIndexChanged;
            //    fldSubFld.Add(frmField.Name, fldData.SubList);
            //    fldSubData.Add(frmField.Name, fldData);
            //}

            for (int Lp1 = 1; Lp1 <= fldData.MaxIdx; Lp1++)
            {
                string thing = fldData.Descr(Lp1);
                if (fldData.Idx(Lp1).Equals(chosenIdx))
                {
                    selIdx = Lp1;
                }
                if (inclParmData)
                {
                    thing += " - " + fldData.Parm(Lp1) + "[" + fldData.Idx(Lp1) + "]";
                }
                frmField.Items.Add(thing);
            }

            //foreach (string province in fldData) {
            //    frmField.Items.Add(province);
            //}

            frmField.SelectedIndex = selIdx;
        }
Пример #2
0
        private void ReportSelector_Load(object sender, EventArgs e)
        {
            listTabs = new List <TabPage>();
            listLsts = new List <ListBox>();

            foreach (KeyValuePair <string, List <string> > newTabs in _lstReports)
            {
                if (newTabs.Value == null)
                {
                    _DBName = newTabs.Key;
                }
                else
                {
                    listTabs.Add(new TabPage());
                    listLsts.Add(new ListBox());
                    int idxTab = listTabs.Count - 1;

                    this.tabReportLists.Controls.Add(listTabs[idxTab]);

                    listTabs[idxTab].Controls.Add(listLsts[idxTab]);
                    listTabs[idxTab].Location = new System.Drawing.Point(4, 22);
                    listTabs[idxTab].Name     = "tabReports" + idxTab.ToString();
                    listTabs[idxTab].Padding  = tabPage1.Padding; // new System.Windows.Forms.Padding(3);
                    listTabs[idxTab].Size     = tabPage1.Size;    // new System.Drawing.Size(303, 313);
                    listTabs[idxTab].TabIndex = idxTab;
                    listTabs[idxTab].Text     = newTabs.Key;
                    listTabs[idxTab].UseVisualStyleBackColor = true;

                    listLsts[idxTab].Anchor = (
                        (System.Windows.Forms.AnchorStyles)
                            (System.Windows.Forms.AnchorStyles.Top |
                            System.Windows.Forms.AnchorStyles.Bottom |
                            System.Windows.Forms.AnchorStyles.Left |
                            System.Windows.Forms.AnchorStyles.Right)
                        );
                    listLsts[idxTab].FormattingEnabled = true;
                    listLsts[idxTab].Location          = new System.Drawing.Point(6, 6);
                    listLsts[idxTab].Name = "listBox";
                    int x = listTabs[idxTab].Size.Width - 12;
                    int y = listTabs[idxTab].Size.Height - 17;
                    listLsts[idxTab].Size                  = new System.Drawing.Size(x, y);
                    listLsts[idxTab].TabIndex              = 0;
                    listLsts[idxTab].SelectedIndexChanged += new System.EventHandler(this.listBox_SelectedIndexChanged);

                    foreach (string item in newTabs.Value)
                    {
                        string itemText;
                        if (item.Substring(0, 1) == "{")
                        {
                            itemText = item.Substring(1, item.IndexOf("}") - 1);
                            _lstReportTitles.Add(idxTab.ToString("000") + "-" + itemText, item.Substring(item.IndexOf("}") + 1));
                        }
                        else
                        {
                            itemText = item;
                        }
                        listLsts[idxTab].Items.Add(itemText);
                    }
                }
            }

            whoAmI     = System.Environment.UserName;
            xMyProfile = new xList("Prof-" + whoAmI, false, true, initValues: new string[] { "Name" }, dbName: _DBName);
        }