-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPasswordForm.cs
More file actions
84 lines (83 loc) · 2.62 KB
/
PasswordForm.cs
File metadata and controls
84 lines (83 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TeachTest
{
public partial class PasswordForm : Form
{
string password = "7890";
public PasswordForm()
{
InitializeComponent();
PasswordBox.Text = "Введите пароль";
PasswordBox.ForeColor = Color.Gray;
if (File.Exists(Directory.GetCurrentDirectory() + $@"\Resources\Password.ini"))
{
string[] s = File.ReadAllLines(Directory.GetCurrentDirectory() + $@"\Resources\Password.ini");
string[] s1 = s[0].Split(new char[] { ' ' });
password = s1[s1.Length - 1].Trim();
}
}
private void EscPict_Click(object sender, EventArgs e)
{
Application.Exit();
}
Point pointTopPanel = new Point();
private void TopText_MouseDown(object sender, MouseEventArgs e)
{
pointTopPanel = new Point(e.X, e.Y);
}
private void TopText_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Left += e.X - pointTopPanel.X;
this.Top += e.Y - pointTopPanel.Y;
}
}
private void ButtonBack_Click(object sender, EventArgs e)
{
this.Close();
StartForm sf = new StartForm();
sf.Show();
}
private void PasswordBox_Enter(object sender, EventArgs e)
{
if (PasswordBox.Text == "Введите пароль")
{
PasswordBox.Text = "";
PasswordBox.ForeColor = Color.Black;
PasswordBox.UseSystemPasswordChar = true;
}
}
private void PasswordBox_Leave(object sender, EventArgs e)
{
if (PasswordBox.Text == "")
{
PasswordBox.Text = "Введите пароль";
PasswordBox.ForeColor = Color.Gray;
PasswordBox.UseSystemPasswordChar = false;
}
}
private void ButtonContinue_Click(object sender, EventArgs e)
{
if(PasswordBox.Text == password)
{
this.Close();
TeacherForm tf = new TeacherForm();
tf.Show();
}
else
{
MessageBox.Show("Пароль неверный!");
}
}
}
}