private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (dataGridView1.CurrentCell == null || dataGridView1.CurrentCell.RowIndex < 0 || // Заголовок столбца dataGridView1.CurrentCell.RowIndex == dataGridView1.RowCount) { return; } HeroesCount formH = new HeroesCount(); formH.P = dataGridView1.CurrentCell.RowIndex; formH.heroBindingSource.DataSource = listP[formH.P].Heros; formH.ShowDialog(); playerBindingSource.ResetCurrentItem(); }
private void button2_Click(object sender, EventArgs e) { var backColor = dataGridView1.RowsDefaultCellStyle.BackColor; HeroesCount formH = new HeroesCount(); formH.P = dataGridView1.CurrentCell.RowIndex; formH.heroBindingSource.DataSource = listP[formH.P].Heros; formH.ShowDialog(); /// if ((int)dataGridView1["HeroC", formH.P].Value == 0 && checkBox1.Checked) // Изменить цвет фона у должника. /// dataGridView1.Rows[formH.P].DefaultCellStyle.BackColor = Color.LightPink; ///else dataGridView1.Rows[formH.P].DefaultCellStyle.BackColor = backColor; }