C# 窗体中显示字符变换大小及来回移动求助
- 提问者网友:刺鸟
- 2021-04-12 05:43
- 五星知识达人网友:逃夭
- 2021-04-12 07:12
一个label,一个timer,自己找个位置写timer的start(); timer的interval = 1000;
public int i = 10;
public bool flag = true;
private void timer1_Tick(object sender, EventArgs e)
{
if (i != 40 && flag == true)
{
label1.Font = new Font("宋体", i+=5);
}
else
{
flag = false;
label1.Font = new Font("宋体", i -= 5);
if (i == 10)
{
flag = true;
}
}
}
- 1楼网友:冷風如刀
- 2021-04-12 09:27
bool Fx = false;//标示方向 private void timer1_Tick(object sender, EventArgs e) { if (button13.Left + button13.Width < 0) { button13.Left = button13.Left + 1; Fx = true; } else { if (button13.Left < this.Width) { if (Fx) { button13.Left = button13.Left + 1; } else { button13.Left = button13.Left - 1; } } else if (button13.Left == this.Width) { Fx = false; button13.Left = button13.Left - 1; }
- 2楼网友:不甚了了
- 2021-04-12 08:39