Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            MonsterViewer viewer = new MonsterViewer(new Monster {
                Name = "New Monster"
            });

            viewer.Show();
        }
 private void Monsters_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     //don't do this on the button column
     if (e.RowIndex > -1 && e.ColumnIndex > -1 && Monsters.Rows.Count > e.RowIndex &&
         Monsters.Rows[e.RowIndex].Cells.Count > e.ColumnIndex)
     {
         var Cell = Monsters.Rows[e.RowIndex].Cells[e.ColumnIndex];
         if (!(Cell is DataGridViewButtonCell))
         {
             //Get the monster in question
             var           monster = battle.monsters[e.RowIndex];
             MonsterViewer viewer  = new MonsterViewer(monster);
             viewer.Show();
         }
     }
 }
Beispiel #3
0
 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     //Don't do this on the button column
     if (e.RowIndex > -1 && e.ColumnIndex > -1 && MonstersGrid.Rows.Count > e.RowIndex &&
         MonstersGrid.Rows[e.RowIndex].Cells.Count > e.ColumnIndex)
     {
         var Cell = MonstersGrid.Rows[e.RowIndex].Cells[e.ColumnIndex];
         if (!(Cell is DataGridViewButtonCell))
         {
             var row = MonstersGrid.Rows[e.RowIndex];
             if (row.DataBoundItem is Monster)
             {
                 var           monster = ((Monster)row.DataBoundItem).Clone();
                 MonsterViewer viewer  = new MonsterViewer(monster);
                 viewer.Show();
             }
         }
     }
 }