C# 界面从无到有 从有到无
来源:互联网 发布:js判断ie浏览器 编辑:程序博客网 时间:2024/06/06 00:01
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
//using NetBLL;
namespace shengqi
{
public partial class Form1 : Form
{
public delegate void SetTime1();//声明委托
public delegate void SetTime2();
public delegate void SetTime3();
public delegate void SetTime4();
public delegate void SetTimeClose();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Top = Screen.PrimaryScreen.Bounds.Height;//得到高
this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width;//得到X坐标
Thread th1 = new Thread(new ThreadStart(setTime1Run));//绑定改变坐标的方法
Thread th2 = new Thread(new ThreadStart(setTime2Run));//绑定改变坐标的方法
//设置为后台线程
th1.IsBackground = true;
th2.IsBackground = true;
th1.Priority = ThreadPriority.Highest;//设置优先级
//起启动线程
th1.Start();
th2.Start();
}
public void setTime1Run()
{
Thread.Sleep(500);
while (this.Bottom > Screen.PrimaryScreen.WorkingArea.Height)//从无到有
{
if (this.InvokeRequired)
{
this.Invoke(new SetTime3(lowerTop));
}
else
{
this.Top--;
}
Thread.Sleep(10);
}
}
public void lowerTop()
{
this.Top--;
}
public void setTime2Run()
{
Thread.Sleep(6000);
while (this.Top < Screen.PrimaryScreen.Bounds.Height)//从有到无
{
if (this.InvokeRequired)
{
this.Invoke(new SetTime4(falloff));
}
else
{
this.Top++;
}
Thread.Sleep(10);
}
if (this.InvokeRequired)
{
this.Invoke(new SetTimeClose(closeForm));
}
else
{
this.Close();
}
}
public void falloff()
{
this.Top++;
}
public void closeForm()
{
this.Close();
}
}
}
- C# 界面从无到有 从有到无
- 安装程序:软件从无到有。卸载程序:软件从有到无。更新程序:软件的覆盖安装,
- 从无到有写一个C#弹球小游戏(一)
- 从无到有写一个C#弹球小游戏(二)
- mysql+C#实战七:从界面输入记录
- 界面.C#
- 从无到有,从动态链编到静态链编,与清华大学合作完成了一个Qt项目
- 进化--从无到有
- Redis从无到有
- 产品从无到有
- 从无到有RNN
- C#界面之弹出界面
- 从无到有写一个C#弹球小游戏(完)(附上游戏完成的截图)
- 从登录界面开始
- C#制作欢迎界面
- C#多线程刷新界面
- c#多线程访问界面
- c#多线程刷新界面
- Myeclipse8.0/8.5丢失配置和默认workspace问题
- Linux 2.6内核标准教程
- 关于Ext在各浏览器中的bug及其解决方法
- RedHatLinux指南服务器设置与程序设计篇
- Struts1乱码
- C# 界面从无到有 从有到无
- 实质风险因素
- Oracle不同版本间导入导出
- HP LoadRunner post 数据
- crontab 学习
- Red Hat Linux指南基础与系统管理篇
- 50个C/C++源码网站
- c/c++模拟推栈
- Jquery获取单选框与复选框选中的值