Windows窗体中的自动滚动标签从上到下,从下到上 [英] Auto Scroll label in windows forms from top to bottom and from bottom to top
本文介绍了Windows窗体中的自动滚动标签从上到下,从下到上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想从上到下,从下到上滚动标签,现在我正在使用一个使用此代码我可以从左向右滚动,任何人都可以建议我。
我也给代码
Hi Everyone,
I want to scroll the label from top to bottom and from bottom to top , Now i am using one code by using this i can scroll from left to right , can any one suggest me please .
I am giving code also
private void timer1_Tick(object sender, EventArgs e)
{
label2.Location = new Point(label2.Location.X + 5, label2.Location.Y);
if (label2.Location.X > this.Width)
{
label2.Location = new Point(0 - label2.Width, label2.Location.Y);
}
}
推荐答案
就像你的代码改变水平分量(X)一样位置并因此产生水平移动,改变垂直分量(Y)以垂直移动。
Just like your code alters the horizontal components (X) of Location and hence gernerates horizontal movement, change the vertical component (Y) to move vertically.
// Do so:
label2.Location = new Point(fixed, changing);
//Instead of
label2.Location = new Point(changing, fixed);
private void timer1_Tick(object sender, EventArgs e)
{
label2.Location = new Point(label2.Location.X, label2.Location.Y + 5);
if (label2.Location.Y > this.Height)
{
//label2.Location = new Point(0 - label2.Width, label2.Location.X);
//label2.Location = new Point(changing, fixed);
label2.Location = new Point( label2.Location.X,0 - label2.Height);
}
}
只需使用此代码从上到下滚动标签
Just use this code for scrolling the labels from top to bottom
这篇关于Windows窗体中的自动滚动标签从上到下,从下到上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文