Ejemplo n.º 1
0
 private void FillButton_Click(object sender, EventArgs e)
 {
     panel3.Controls.Clear();
     items = new List <SortedItem>();
     if (int.TryParse(FillTextBox.Text, out int value))
     {
         var rnd = new Random();
         for (int i = 0; i < value; i++)
         {
             var item = new SortedItem(rnd.Next(0, 100), items.Count);
             items.Add(item);
             this.panel3.Controls.Add(item.ProgressBar);
             this.panel3.Controls.Add(item.Label);
         }
     }
     FillTextBox.Clear();
 }
Ejemplo n.º 2
0
 private void FillRandomNumbersButton_Click(object sender, EventArgs e)
 {
     if (int.TryParse(FillTextBox.Text, out int numbers))
     {
         if (SpeedTrackBar.Value > 0 && numbers <= maxSortedItemsCount || SpeedTrackBar.Value == 0)
         {
             int    value;
             Random rnd = new Random();
             values.Clear();
             for (int i = 0; i < numbers; i++)
             {
                 value = rnd.Next(0, maxValue);
                 values.Add(value);
             }
             RefillItems(SpeedTrackBar.Value > 0);
             FillTextBox.Text = "";
             FillTextBox.Focus();
         }
     }
 }
Ejemplo n.º 3
0
        private void Form1_Shown(object sender, EventArgs e)
        {
            for (int i = 1; i < ResultTableLayoutPanel.ColumnCount; i++)
            {
                panel3.Controls["radioButton" + i.ToString()].Text = allMethods[i - 1, 0];
                Color foreColor = allMethods[i - 1, 3] == "0" ? SystemColors.ControlText : Color.DeepSkyBlue;
                for (int j = 0; j < ResultTableLayoutPanel.RowCount; j++)
                {
                    Control control = ResultTableLayoutPanel.GetControlFromPosition(i, j);
                    if (control != null)
                    {
                        if (j == 1)
                        {
                            control.Text = allMethods[i - 1, 0] + " " + allMethods[i - 1, 1];
                        }
                        if (j == 2)
                        {
                            control.Text = "[" + i.ToString() + "]";
                        }
                        if (j > 2)
                        {
                            control.Text = "-";
                        }
                        control.ForeColor = foreColor;
                    }
                }
            }


            for (int i = 1; i <= 3; i++)
            {
                ResultTableLayoutPanel.Controls["TestsRadioButton_" + i.ToString()].Enabled = false;
            }

            //ResultTableLayoutPanel.Refresh();
            //ResultTableLayoutPanel.CellPaint -= ResultTableLayoutPanel_CellPaint;
            FillTextBox.Focus();
        }