This repository has been archived by the owner on Sep 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenuForm.cs
105 lines (94 loc) · 3.13 KB
/
menuForm.cs
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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 Bookstore
{
public partial class menuForm : Form
{
string username;
public menuForm(string loginUsername)
{
InitializeComponent();
username = loginUsername;
}
private bool dragging = false;
private Point dragCursorPoint;
private Point dragFormPoint;
private void bunifuGradientPanel1_MouseDown(object sender, MouseEventArgs e)
{
dragging = true;
dragCursorPoint = Cursor.Position;
dragFormPoint = this.Location;
}
private void bunifuGradientPanel1_MouseMove(object sender, MouseEventArgs e)
{
if (dragging)
{
Point dif = Point.Subtract(Cursor.Position, new Size(dragCursorPoint));
this.Location = Point.Add(dragFormPoint, new Size(dif));
}
}
private void bunifuGradientPanel1_MouseUp(object sender, MouseEventArgs e)
{
dragging = false;
}
private void menuForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
{
var result = MessageBox.Show("Ești sigur că dorești să ieși?", "Ieșire",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
Application.Exit();
}
}
private void pictureBox3_Click(object sender, EventArgs e)
{
this.Hide();
showForm f = new showForm(username);
f.Show();
}
private void pictureBox5_Click(object sender, EventArgs e)
{
if (username == "admin")
{
this.Hide();
registerMenu f = new registerMenu(username);
f.Show();
}
else
MessageBox.Show("Doar administratorul poate accesa această funcție!", "Eroare",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
private void bunifuGradientPanel1_Paint(object sender, PaintEventArgs e)
{
}
private void pictureBox2_Click(object sender, EventArgs e)
{
this.Hide();
loginForm f = new loginForm();
f.Show();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
if (username == "admin")
{
this.Hide();
deleteMenu f = new deleteMenu(username);
f.Show();
}
else
MessageBox.Show("Doar administratorul poate accesa această funcție!", "Eroare",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}