C# winform 中实现label字体移动
2010-01-27 17:42
405 查看
代码
1
2 #region//拼接字符
3 private void timer1_Tick(object sender, EventArgs e)
4 {
5 int length=label1.Text.Length;
6 string str = label1.Text.Substring(0, 1);
7 string str2 = label1.Text.Substring(1, length-1);
8 label1.Text = str2 + str;
9 }
10 #endregion
11
12
13 #region//改变label位置(推荐)
14 private void timer1_Tick(object sender, EventArgs e)
15 {
16 if (label1.Location.X < 0 && Math.Abs(label1.Location.X) - label1.Width >= 0)
17 {
18 label1.Location = new Point(panel1.Width, label1.Location.Y);
19 return;
20 }
21 label1.Location = new Point(label1.Location.X - 5, label1.Location.Y);
22 }
23
24 #endregion
都是基于timer实现。
1
2 #region//拼接字符
3 private void timer1_Tick(object sender, EventArgs e)
4 {
5 int length=label1.Text.Length;
6 string str = label1.Text.Substring(0, 1);
7 string str2 = label1.Text.Substring(1, length-1);
8 label1.Text = str2 + str;
9 }
10 #endregion
11
12
13 #region//改变label位置(推荐)
14 private void timer1_Tick(object sender, EventArgs e)
15 {
16 if (label1.Location.X < 0 && Math.Abs(label1.Location.X) - label1.Width >= 0)
17 {
18 label1.Location = new Point(panel1.Width, label1.Location.Y);
19 return;
20 }
21 label1.Location = new Point(label1.Location.X - 5, label1.Location.Y);
22 }
23
24 #endregion
都是基于timer实现。
相关文章推荐
- C# Winform DataGridView实现行[Row]的上下移动
- c# WinForm中如何在代码中设置控件的padding 设置Label的字体
- 在C#中实现listbox的项上下移动(winform)
- C#之WinForm基础 应用button,实现listbox的蓝条上下循环移动
- C# winform中,简单实现Listview.Subitem.BackColor.ForeColor改变字体颜色,Listview.Subitem.BackColor 改变背景
- 在C#中实现listbox的项上下移动(winform) 标准
- C# 自定义Label实现 指定字符串(关键词)高亮显示(字体、颜色)
- 在C#中实现两个listbox的项移动(winform)
- 【转载】C# WinForm中的Label实现自动换行
- C# 在winform中隐藏或者去除c#的标题栏并实现窗体移动附代码
- 在C#中实现标签(Label)随鼠标移动而移动
- c# WinForm中如何在代码中设置控件的padding 设置Label的字体
- C#实现Winform无边框移动的方法
- C# WinForm Label 控件拓展—变色字体、超链接
- C# WinForm 实现增删改查等功能(Access版) 系列之四
- 在WinForm中使用Web Services 来实现 软件 自动升级( Auto Update ) (C#)
- C# 、winform 添加皮肤后(IrisSkin2) label设置的颜色 无法显示
- C#实现字体旋转的方法
- C# 实现 在 WinForm 和 WebForm 中的权限控制
- 【转】C# WinForm中Panel实现用鼠标操作滚动条