利用 Label 控制項顯示文字,配合 Timer 定期修改 Label.Left 屬性,使文字在視窗中水平移動。若時間間隔適當,即可產生平滑滾動視覺效果。
private void timer1_Tick(object sender, EventArgs e)
{
if (label1.Left < this.Width)
{
label1.Left = label1.Left + 50;
}
else if (label1.Left > -this.Width)
{
label1.Left = -label1.Width;
}
}
PictureBox 配合 DrawString 繪製文字,效能更佳。