求 c# 写 屏保 小程序
求c#写 屏保 小程序 要源码的
using System; using System.Collections.Generic; using using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { /// <summary> /// 屏保From1, 在该窗体属性上 设为无边窗体,状态设为最大化 /// </summary> public Form1() { InitializeComponent(); } Point MousePosition;//p1用于获取屏保启动时鼠标位置 private void Form1_Load(object sender, EventArgs e) { Cursor.Hide();//隐藏鼠标 MousePosition = new Point(Cursor.Position.X,Cursor.Position.Y);//记下鼠标初始位置 timer1.Start(); } private void Form1_KeyPress(object sender, KeyPressEventArgs e)//按下键盘时,屏保关闭 { this.Close(); } //通过计时器判断鼠标位置是否改变 private void timer1_Tick(object sender, EventArgs e) { if(MousePosition != Cursor.Position)//鼠标位置改变时,屏保关闭 { this.Close(); } } private void Form1_Deactivate(object sender, EventArgs e)//当前窗体被挂起时,屏保关闭 { this.Close(); } private void Form1_MouseClick(object sender, MouseEventArgs e)//鼠标点击时,屏保关闭 { this.Close(); } } }