void label1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Label lb=sender as Label;
e.Graphics.DrawString(lb.Text,lb.Font,Brushes.Black,new PointF(paintX,0));
} void timer_Tick(object sender, EventArgs e)
{
paintX=(++paintX)%label1.Width;
label1.Invalidate();
}或
private void Form1_Load(object sender, EventArgs e)
{
this.label1.Location = new Point(0, 0);
} int xPox = 0;
bool ist = true;
private void timer1_Tick(object sender, EventArgs e)
{
this.label1.Location = new Point(xPox,this.label1.Location.Y);
if (xPox == this.Width-this.label1.Size.Width)
ist = false;
if(xPox==0)
ist = true;
if (ist)
xPox++;
else
xPox--;
}
{
Label lb=sender as Label;
e.Graphics.DrawString(lb.Text,lb.Font,Brushes.Black,new PointF(paintX,0));
} void timer_Tick(object sender, EventArgs e)
{
paintX=(++paintX)%label1.Width;
label1.Invalidate();
}或
private void Form1_Load(object sender, EventArgs e)
{
this.label1.Location = new Point(0, 0);
} int xPox = 0;
bool ist = true;
private void timer1_Tick(object sender, EventArgs e)
{
this.label1.Location = new Point(xPox,this.label1.Location.Y);
if (xPox == this.Width-this.label1.Size.Width)
ist = false;
if(xPox==0)
ist = true;
if (ist)
xPox++;
else
xPox--;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货