Esempio n. 1
0
 private void numericUpDown2_ValueChanged(object sender, EventArgs e)
 {
     categories2.Clear();
     panel3.Controls.Clear();
     for (var i = 0; i < (numericUpDown2.Value); i++)
     {
         TextBox a = textBox4;
         CheckComboBoxTest.CheckedComboBox d = checkedComboBox3;
         d.DisplayMember = "name";
         d.ValueMember   = "id";
         TextBox temp1 = new TextBox();
         CheckComboBoxTest.CheckedComboBox temp2 = new CheckComboBoxTest.CheckedComboBox();
         temp1.Name  = "temp1." + i.ToString();
         temp2.Name  = "temp2." + i.ToString();
         temp1.Text  = ("смена " + (i + 1).ToString());
         temp1.Width = a.Width;
         temp2.Width = d.Width;
         foreach (var obj in d.Items)
         {
             temp2.Items.Add(obj);
         }
         temp2.DisplayMember = "name";
         temp2.ValueMember   = "id";
         temp1.Location      = new Point(a.Location.X, a.Location.Y + a.Height * i + 35 * i);
         temp2.Location      = new Point(d.Location.X, d.Location.Y + d.Height * i + 36 * i);
         panel3.Controls.Add(temp1);
         panel3.Controls.Add(temp2);
         category_halder item = new category_halder();
         item.a = temp1;
         item.d = temp2;
         categories2.Add(item);
     }
 }
Esempio n. 2
0
        private void ResetEndeFahrstrassen()
        {
            int i = 1;

            for (; i < _endFahrstrassen.Count;)
            {
                CheckComboBoxTest.CheckedComboBox altesControl = _endFahrstrassen[_endFahrstrassen.Count - 1];
                _endFahrstrassen.RemoveAt(_endFahrstrassen.Count - 1);
                altesControl.DropDownClosed -= new System.EventHandler(this.checkedComboBox2_DropDownClosed);
                this.panel1.Controls.Remove(altesControl);
                altesControl.Dispose();
            }
            _endFahrstrassen[0].Text = "";
        }
Esempio n. 3
0
        private void ResetStartFahrstrassen()
        {
            int i = 1;

            for (; i < _startFahrstrassen.Count;)
            {
                CheckComboBoxTest.CheckedComboBox altesControl = _startFahrstrassen[_startFahrstrassen.Count - 1];
                _startFahrstrassen.RemoveAt(_startFahrstrassen.Count - 1);
                altesControl.DropDownClosed -= new System.EventHandler(this.checkedComboBox1_DropDownClosed);
                this.panel1.Controls.Remove(altesControl);
                altesControl.Dispose();
            }
            _startFahrstrassen[0].Text = "";
            PositionierenControls();
        }
Esempio n. 4
0
        private void checkedComboBox1_DropDownClosed(object sender, EventArgs e)
        {
            CheckComboBoxTest.CheckedComboBox control = (CheckComboBoxTest.CheckedComboBox)sender;
            if (!control.ValueChanged)
            {
                return;
            }
            if (control.CheckedItems.Count == 0)
            {
                int i = 0;
                for (; i < _startFahrstrassen.Count; i++)
                {
                    if (_startFahrstrassen[i] == control)
                    {
                        i++;
                        break;
                    }
                }
                for (; i < _startFahrstrassen.Count;)
                {
                    CheckComboBoxTest.CheckedComboBox altesControl = _startFahrstrassen[_startFahrstrassen.Count - 1];
                    _startFahrstrassen.RemoveAt(_startFahrstrassen.Count - 1);
                    altesControl.DropDownClosed -= new System.EventHandler(this.checkedComboBox1_DropDownClosed);
                    this.panel1.Controls.Remove(altesControl);
                    altesControl.Dispose();
                }
                PositionierenControls();
            }
            else if (control.CheckedItems.Count == 1)
            {
                int i = 0;
                for (; i < _startFahrstrassen.Count; i++)
                {
                    if (_startFahrstrassen[i] == control)
                    {
                        i++;
                        break;
                    }
                }
                CheckComboBoxTest.CheckedComboBox neuesControl = null;
                if (i == _startFahrstrassen.Count)
                {
                    neuesControl = new CheckComboBoxTest.CheckedComboBox();
                    this.panel1.Controls.Add(neuesControl);
                    neuesControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                                | System.Windows.Forms.AnchorStyles.Right)));
                    neuesControl.CheckOnClick      = true;
                    neuesControl.DrawMode          = System.Windows.Forms.DrawMode.OwnerDrawVariable;
                    neuesControl.DropDownHeight    = 1;
                    neuesControl.FormattingEnabled = true;
                    neuesControl.IntegralHeight    = false;
                    neuesControl.Size            = new System.Drawing.Size(151, 21);
                    neuesControl.Location        = new System.Drawing.Point(control.Location.X, control.Location.Y - neuesControl.Size.Height - 5);
                    neuesControl.Name            = "checkedComboBox1_" + i;
                    neuesControl.TabIndex        = 0;
                    neuesControl.Text            = "";
                    neuesControl.ValueSeparator  = ", ";
                    neuesControl.DropDownClosed += new System.EventHandler(this.checkedComboBox1_DropDownClosed);
                    neuesControl.Enabled         = true;

                    _startFahrstrassen.Add(neuesControl);
                    PositionierenControls();
                }
                else
                {
                    neuesControl = _startFahrstrassen[i];

                    i++;
                    for (; i < _startFahrstrassen.Count;)
                    {
                        CheckComboBoxTest.CheckedComboBox altesControl = _startFahrstrassen[_startFahrstrassen.Count - 1];
                        _startFahrstrassen.RemoveAt(_startFahrstrassen.Count - 1);
                        altesControl.DropDownClosed -= new System.EventHandler(this.checkedComboBox1_DropDownClosed);
                        this.panel1.Controls.Remove(altesControl);
                        altesControl.Dispose();
                    }
                    PositionierenControls();
                }

                neuesControl.Items.Clear();
                neuesControl.Text = "";
                int        zielSignalId = (int)control.CheckedItems[0];
                List <int> signale      = new List <int>();
                foreach (FahrstrasseN fs in _anlagenElemente.FahrstrassenElemente.GespeicherteFahrstrassen)
                {
                    if (zielSignalId == fs.EndSignal.ID)
                    {
                        if (!signale.Contains(fs.StartSignal.ID))
                        {
                            signale.Add(fs.StartSignal.ID);
                        }
                    }
                }
                signale.Sort();
                foreach (int sig in signale)
                {
                    neuesControl.Items.Add(sig);
                }
            }
            else
            {
                int i = 0;
                for (; i < _startFahrstrassen.Count; i++)
                {
                    if (_startFahrstrassen[i] == control)
                    {
                        i++;
                        break;
                    }
                }
                for (; i < _startFahrstrassen.Count;)
                {
                    CheckComboBoxTest.CheckedComboBox altesControl = _startFahrstrassen[_startFahrstrassen.Count - 1];
                    _startFahrstrassen.RemoveAt(_startFahrstrassen.Count - 1);
                    altesControl.DropDownClosed -= new System.EventHandler(this.checkedComboBox1_DropDownClosed);
                    this.panel1.Controls.Remove(altesControl);
                    altesControl.Dispose();
                }
                PositionierenControls();
            }
        }