public static void PrintThisType(string type) { PrintThisType print = new PrintThisType(); foreach (object animal in animals) { switch (type) { case "Животное": if (animal is KingdomAnimal) { print.Output(animal as KingdomAnimal); } break; case "Млекопитающее": if (animal is ClassMammals) { print.Output(animal as ClassMammals); } break; case "Птица": if (animal is ClassBirds) { print.Output(animal as ClassBirds); } break; case "Парнокопытное": if (animal is OrderArtiodactyl) { print.Output(animal as OrderArtiodactyl); } break; } } }
private void ПечатьЭлементовДанногоТипаToolStripMenuItem_Click(object sender, EventArgs e) { PrintThisType form = new PrintThisType(); form.ShowDialog(); }
private void ПечатьОсобейДанногоВидаToolStripMenuItem_Click(object sender, EventArgs e) { PrintThisType form = new PrintThisType(); form.ShowDialog(); }