用C#(Winform)的Timer控件让窗体左右飘动
来源:互联网 发布:减肥不反弹知乎 编辑:程序博客网 时间:2024/04/29 23:29
今天在公司做关于gis地图的事,做的头疼,一点都不想做了,然后研究了下Winform中的Timer控件,可以用这个控件让窗体左右浮动。
分享下代码:用了两个timer控件,和一个Label控件。
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication2{ public partial class Form3 : Form { private int t; public Form3() { InitializeComponent(); Point p = new Point(0,240); this.DesktopLocation = p; this.timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { Point p = new Point(this.DesktopLocation.X+1,this.DesktopLocation.Y); this.DesktopLocation = p; if(p.X==550) { this.timer1.Stop(); MessageBox.Show("跑的好累啊","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning); this.timer2.Start(); } } private void timer2_Tick(object sender, EventArgs e) { Point p = new Point(this.DesktopLocation.X-1,this.DesktopLocation.Y); this.DesktopLocation = p; if (p.X == 0) { t++; this.timer2.Stop(); this.label1.Text = "劳资跑了"+t.ToString()+"圈了"; MessageBox.Show("加油,继续跑哦!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning); this.timer1.Start(); } } }}
- 用C#(Winform)的Timer控件让窗体左右飘动
- 让窗体飘动起来--C#中Timer组件用法
- 让窗体飘动起来--C#中Timer组件用法
- [转]让窗体飘动起来 C#中Timer组件用法
- 让窗体飘动起来 C#中Timer组件用法
- C#编程技巧集.让窗体飘动起来.C#中Timer组件用法
- 用C#制作飘动的窗体效果
- 用C#制作飘动的窗体效果
- 用C#制作飘动的窗体效果
- 【C#】c#winform 窗体及其控件的自适应
- [SY的专栏]C#WinForm制作异形窗体/控件
- C#:生成基于WinForm的不规则窗体或控件
- # winform 用子窗体刷新父窗体,子窗体改变父窗体控件的值
- C# winform 用子窗体刷新父窗体,子窗体改变父窗体控件的值
- winform 用子窗体刷新父窗体,子窗体改变父窗体控件的值
- 飘动窗体
- C#WinForm制作异形窗体/控件
- C#WinForm制作异形窗体/控件
- oracle分页查询数据重复问题、分页排序陷阱
- android 计时器 Timer
- HttpRequest.Files 属性
- bug总结-ie7下两列布局,右侧不能设置width100%
- hrbustoj 1291 点在凸多边形内
- 用C#(Winform)的Timer控件让窗体左右飘动
- C++ 线程安全的 单实例 模式
- Caused by: java.lang.OutOfMemoryError: Java heap space
- Windows内存管理(2)--Lookaside结构 和 运行时函数
- Android 去掉ListView/GridView下拉出空白回弹的效果
- elasticsearch获取java client实例
- nginx中获取真实ip
- JAVA获取本机网卡IP地址
- dgsd