逐行显示文字

public partial class Form1 : Form { Timer timer = new Timer(); string[] lines = { "hellow world", "nihao", "line3", "line4", "line5", "end" }; int currentLine = 0; public Form1() { InitializeComponent(); timer.Interval = 300; timer.Tick += delegate { currentLine++; this.Invalidate(); }; timer.Start(); } protected override void OnPaint(PaintEventArgs e) { for (int i = 0; i < currentLine % lines.Length; i++) { e.Graphics.DrawString(lines[i], this.Font, Brushes.Black, 10, 20 * i); } } }

你可能感兴趣的:(逐行显示文字)