CssSolution/CSS_Solution/Forms/Welcome_Form.cs

79 lines
2.5 KiB
C#

using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CSS_Solution.Forms
{
public partial class Welcome_Form : Form
{
public Welcome_Form()
{
InitializeComponent();
}
private Font normal_font = new Font("Microsoft YaHei UI", 15F, FontStyle.Regular, GraphicsUnit.Point, 134);
private Font italic_font = new Font("Microsoft YaHei UI", 15F, FontStyle.Italic, GraphicsUnit.Point, 134);
private void ID_Enter(object sender, EventArgs e)
{
if (ID.Font != normal_font)
{
ID.Text = string.Empty;
ID.ForeColor = Color.White;
ID.Font = normal_font;
}
}
private void ID_Leave(object sender, EventArgs e)
{
if (ID.Text == string.Empty)
{
ID.ForeColor = Color.Silver;
ID.Font = italic_font;
ID.Text = "学号...";
}
}
private void password_Enter(object sender, EventArgs e)
{
if (password.Font != normal_font)
{
password.Text = string.Empty;
password.ForeColor = Color.White;
password.Font = normal_font;
password.PasswordChar = '*';
}
}
private void password_Leave(object sender, EventArgs e)
{
if (password.Text == string.Empty)
{
password.ForeColor = Color.Silver;
password.Font = italic_font;
password.Text = "密码...";
password.PasswordChar = '\0';
}
}
bool save_disk_info_showed = false;
private void SavePassword_CheckedChanged(object sender, EventArgs e)
{
if (sender == null||save_disk_info_showed)
return;
CheckBox? checkBox = sender as CheckBox;
if (checkBox == null) return;
if(checkBox.Checked)
{
save_disk_info_showed = true;
MessageBox.Show("注意,密码确实会保存为密文,但是该密文可直接用于登录网站(教务管理系统),理想状态下,该密码应当仅保存在内存中。");
}
}
}
}