private void btnStart_Click(object sender, EventArgs e) { var shaps = new List<Shape> { new Rectangle(), new Triangle(), new Cicrle() }; foreach (Shape s in shaps) { rtxtDisplay.SelectionStart = rtxtDisplay.Text.Length; if (s.Draw().Contains("圓")) { rtxtDisplay.SelectionColor = Color.Red; } else if (s.Draw().Contains("矩形")) { rtxtDisplay.SelectionColor = Color.Green; } else { rtxtDisplay.SelectionColor = Color.Yellow; } rtxtDisplay.AppendText(s.Draw()); rtxtDisplay.AppendText(System.Environment.NewLine); } rtxtDisplay.AppendText(System.Environment.NewLine); }