private void fillPanelBox()
        {
            PanelBox.Items.Clear();
            PanelChoiceBox.Items.Clear();
            query = "select * from panels order by Priority asc";
            panels = database.GetTable(query);

            foreach (DataRow row in panels.Rows)
            {
                PanelItem newPanel = new PanelItem();
                newPanel.name = row["PanelName"].ToString();
                newPanel.id = row["PanelID"].ToString();
                PanelBox.Items.Add(newPanel);
                PanelChoiceBox.Items.Add(newPanel);
            }
        }
Пример #2
0
        private void updateButtonList(PanelItem panel)
        {
            for (int i = 0; i < this.Controls.Count; i++)
            {
                if (Controls[i] is Button)
                {
                    if (!Controls[i].Name.Equals("EditButton"))
                    {
                        Controls.RemoveAt(i);
                        i--;
                    }
                }
            }

            int buttonX = 384;
            int buttonY = 109;
            int tabIndex = 1;

            foreach (FormItem form in formItems)
            {
                if (form.panel.Equals(((PanelItem)PanelList.SelectedItem).id))
                {
                    Button newButton = new Button();
                    newButton.Location = new Point(buttonX, buttonY);
                    newButton.BackColor = SystemColors.Window;
                    newButton.FlatStyle = FlatStyle.Popup;
                    newButton.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
                    newButton.Size = new Size(400, 40);
                    newButton.TabIndex = tabIndex;
                    newButton.Text = form.name;
                    newButton.UseVisualStyleBackColor = false;
                    newButton.Click += (s, e) => { openForm(form, (ClientItem)clientList.SelectedItem); };
                    Controls.Add(newButton);

                    buttonY += 45;
                    tabIndex++;
                }
            }
        }