Пример #1
0
        private void ViewArray()
        {
            int k = 0;

            ShowBox.Clear();
            foreach (ArrInt ar in ArrInt1)
            {
                // ShowBox.Text += "Массив:" + k + ar.ToString() + "\n";
                ShowBox.Text += ar.ToString() + "\n";
                k++;
            }
            int i = 0;

            DataGridViewInitializeOdnomer();
            dataGridView2.ReadOnly = true;
            dataGridView2.RowCount = ArrInt1.Count;
            foreach (ArrInt ar in ArrInt1)
            {
                for (int j = 0; j < dataGridView2.ColumnCount; j++)
                {
                    this.dataGridView2.Rows[i].Cells[j].Value = ar.ShowArray(j, dataGridView2.ColumnCount);
                }
                i++;
            }
        }
 private void DelBtn_Click(object sender, EventArgs e)
 {
     DataList.Items.Clear();
     myList.Clear();
     OutputLabel.Text = "Input";
     UserBox.Clear();
     ShowBox.Clear();
     InputBox.Clear();
 }
        private void RemoveBtn_Click(object sender, EventArgs e)
        {
            int n;

            try{
                n = DataList.SelectedIndex;
                myList.RemoveAt(n);
                DataList.Items.RemoveAt(n);
                ShowBox.Clear();
            }
            catch { return; }
        }
Пример #4
0
        private void УменьшитьВсеНа1ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ShowBox.Clear();
            List <int> IndexToInc = dataGridView2.SelectedRows.Cast <DataGridViewRow>().Select(x => x.Index).ToList();

            if (IndexToInc.Count != 0)
            {
                IndexToInc.Sort();
                while (IndexToInc.Count != 0)
                {
                    ArrInt a = ArrInt1[IndexToInc[0]] as ArrInt;
                    a--;
                    IndexToInc.RemoveAt(0);
                    ViewArray();
                }
            }
            else
            {
                MessageBox.Show(ERR_SELECTED, ERR, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }