C#编程编写锁屏程序

C#编程编写锁屏程序,第1张

新建一个窗体,将MaximizeBox,MinimizeBox属性设置为枝卖False(意思就是将最大化,最小化按钮屏蔽掉)

在这个窗猛凯逗体的Closeing事件里e.Cancel = true(意思就是叫关闭按钮孙局失灵)

还有一个就是叫这个窗体加载的是后就最大化将属性WindoeState更改为Maximized

下面是我用2005写的一个锁屏程序:

using System

using System.Collections.Generic

using System.ComponentModel

using System.Data

using System.Drawing

using System.Text

using System.Windows.Forms

namespace KTV

{

/// <summary>

/// 挂起

/// </summary>

public partial class FrmGuaQi : Form

{

private string Pwd

private bool bl = true

public FrmGuaQi()

{

InitializeComponent()

}

/// <summary>

///

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btnGuanqi_Click(object sender, EventArgs e)

{

if (this.btnGuanqi.Text == "挂起")

{

this.Pwd = this.txtPwd.Text

this.btnGuanqi.Text = "解除"

this.txtPwd.Clear()

}

else

{

if (this.Pwd == this.txtPwd.Text)

{

bl = false

this.Close()

}

else

{

MessageBox.Show("密码不正确","错误",MessageBoxButtons.OK,MessageBoxIcon.Error)

}

}

}

private void FrmGuaQi_FormClosing(object sender, FormClosingEventArgs e)

{

// 屏蔽Alt+F4关闭

e.Cancel = bl

}

private void FrmGuaQi_Load(object sender, EventArgs e)

{

Common.ApplySkin(mySkin, this)

}

}

}

你说的锁屏是windows系虚拆统中的锁定还是windows mobile或者其它windows手机系统的锁屏。

如果是手机系统的话,可以在得到最高权限的时候,调用系统的锁屏函数。

原理是,程序启动后,先检测有没有设置过密码,有的话d出输入密码框,并进行密码比对,正确则解锁。

如果没有设置过密码培闷则提示设置密码,密码可以保差中枣存在本地,这个看你的设计了


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12446230.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-25
下一篇 2023-05-25

发表评论

登录后才能评论

评论列表(0条)

保存