基本信息
源码名称:定时强制锁屏休息程序源码下载(C#)
源码大小:0.04M
文件格式:.zip
开发语言:C#
更新时间:2019-04-29
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
每到半点的时候强制提示休息,过后自动恢复
每到半点的时候强制提示休息,过后自动恢复
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;
using Microsoft.Win32;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
namespace WinLockScreen
{
public partial class Form1 : Form
{
#region 变量
Random Random1 = new Random();
#endregion
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Hide();
btnClose.Hide();
lblInfo1.Text = "Width:" this.Width.ToString();
lblInfo2.Text = "Height:" this.Height.ToString();
lblInfo3.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//lblInfo1.Text = this.Width.ToString();
SetTopMost();
btnClose.Location = new Point(this.Width - 150, this.Height - 50);
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Hide();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (DateTime.Now.Minute % 30 != 0)
//if (DateTime.Now.Second % 20 < 10)
{
this.Hide();
}
else
{
this.Show();
SetTopMost();
lblInfo3.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
SetLblTipMessageChange();
}
}
/// <summary>
/// 设置窗体为最前显示
/// </summary>
void SetTopMost()
{
this.TopMost = false;
this.TopMost = true;
}
/// <summary>
/// 改变提示信息位置
/// </summary>
void SetLblTipMessageChange()
{
int width = this.Width - Random1.Next(this.Width - lblTipMessage.Width);
int height = this.Height - Random1.Next(this.Height - lblTipMessage.Height);
lblTipMessage.Location = new Point(width, height);
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Modifiers == Keys.Alt && e.KeyCode == Keys.F4)
{
e.Handled = true;
}
}
private void btnCloseTaskmgr_Click(object sender, EventArgs e)
{
}
}
}