标题:求 c# 写 屏保 小程序
只看楼主
风中追疯
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-7-24
结帖率:0
已结贴  问题点数:5 回复次数:3 
求 c# 写 屏保 小程序
求c#写 屏保 小程序 要源码的
2014-07-24 12:45
邓士林
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:淮河河畔
等 级:贵宾
威 望:61
帖 子:2391
专家分:13384
注 册:2013-3-3
得分:3 

Maybe
2014-07-24 22:16
yanglin_gdqy
Rank: 2
等 级:论坛游民
威 望:3
帖 子:59
专家分:86
注 册:2013-12-2
得分:3 
程序代码:
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();
        }
    }
}
2014-07-26 03:25
漫檬
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2014-8-5
得分:0 
牛人,代码收下了
多谢,多谢
2014-08-05 13:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-434348-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.404661 second(s), 10 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved