コード例 #1
0
 // клик по гриду
 private void dataGridViewListOfDetails_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex == -1 || e.ColumnIndex == -1)
     {
         return;
     }
     if (e.RowIndex > -1)
     {
         indexSelected = (int)dataGridViewListOfDetails["Number", e.RowIndex].Value;
         if (dataGridViewListOfDetails.Columns[e.ColumnIndex].HeaderText == "Удалить")     // если нажата кнопка *Удалить*
         {
             dataGridViewListOfDetails.Rows.RemoveAt(e.RowIndex);
             Globals.dictQwewe.Remove(indexSelected);
         }
         if (dataGridViewListOfDetails.Columns[e.ColumnIndex].HeaderText == "Редактировать") // если нажата кнопка *Редактировать*
         {
             DataGridViewRow DGVR = dataGridViewListOfDetails.Rows[e.RowIndex];              // целая строка, которую будем передавать в конструктор юзерконтрола-редактора технологии
             RemoveMainControl();
             FreeTechUserControl FTUC = new FreeTechUserControl(Globals.dictQwewe[indexSelected], indexSelected, DGVR);
             FTUC.Dock = DockStyle.Fill;
             tableLayoutPanel2.Controls.Add(FTUC, 0, 1);
         }
         if (dataGridViewListOfDetails.Columns[e.ColumnIndex].HeaderText == "Печатать")     // если нажата кнопка *Печатать*
         {
             bool val = (bool)((DataGridView)sender)[e.ColumnIndex, e.RowIndex].Value;
             ((DataGridView)sender)[e.ColumnIndex, e.RowIndex].Value = !val;
         }
         if (dataGridViewListOfDetails.Columns[e.ColumnIndex].HeaderText == "Дублировать")     // если нажата кнопка *Дублировать*
         {
             Technology tecnologyToClone = Globals.dictQwewe[indexSelected];
             Globals.AddTechnology(tecnologyToClone.Clone());
         }
     }
     Globals.labelCountOfActs.Text = "Кол-во д/а - " + Globals.dictQwewe.Count;
 }
コード例 #2
0
        private void FreeTech_Click(object sender, EventArgs e)
        {
            RemoveMainControl();
            FreeTechUserControl FTUC = new FreeTechUserControl();

            FTUC.Dock = DockStyle.Fill;
            tableLayoutPanel2.Controls.Add(FTUC, 0, 1);
        }