Beispiel #1
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();
         }
     }
 }
Beispiel #2
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();
        }