📄 loginform.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CTestApp
{
public partial class LoginForm : Form
{
private int iCounter = 0;
public LoginForm()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "CTT")
{
this.DialogResult = DialogResult.OK;
}
else
{
if (++iCounter == 3)
{
MessageBox.Show("输入错误次数达到3次,将退出应用程序", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.DialogResult = DialogResult.Cancel;
}
else
{
MessageBox.Show("密码不正确,请重新输入", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -