loginform.cs
来自「计算机考试管理系统 包括模拟测试」· CS 代码 · 共 40 行
CS
40 行
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 + =
减小字号Ctrl + -
显示快捷键?