-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.cs
149 lines (139 loc) · 5.55 KB
/
Main.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
using System;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Windows.Forms;
namespace BillingSystem
{
public partial class Main : Form
{
public static Color brandColor = Color.FromArgb(94, 2, 42); // HTML code: #5E022A
public static Color yellowColor = Color.FromArgb(248, 189, 68); // HTML code: #F8BD44
public static void SetControlsColor(Form form)
{
form.BackColor = Main.brandColor;
foreach (Control c in form.Controls)
{
if (c.GetType() == typeof(Label))
{
c.ForeColor = Color.White;
}
else if (c.GetType() == typeof(TextBox))
{
c.BackColor = Main.yellowColor;
}
else if (c.GetType() == typeof(DateTimePicker))
{
c.BackColor = Main.yellowColor;
}
else if (c.GetType() == typeof(Button))
{
c.BackColor = Main.yellowColor;
}
else if (c.GetType() == typeof(ComboBox))
{
c.BackColor = Main.yellowColor;
}
else if (c.GetType() == typeof(PrintPreviewControl))
{
c.ForeColor = Main.yellowColor;
}
else if (c.GetType() == typeof(DataGridView))
{
((DataGridView)c).BackgroundColor = Main.brandColor;
((DataGridView)c).RowsDefaultCellStyle.BackColor = Main.yellowColor;
((DataGridView)c).ColumnHeadersDefaultCellStyle.ForeColor = Main.brandColor;
((DataGridView)c).ColumnHeadersDefaultCellStyle.BackColor = Main.brandColor;
((DataGridView)c).RowHeadersDefaultCellStyle.BackColor = Main.yellowColor;
}
else if (c.GetType() == typeof(BindingNavigator))
{
c.BackColor = Main.brandColor;
foreach (var item in ((BindingNavigator)c).Items)
{
if (item.GetType() == typeof(ToolStripButton))
{
//((ToolStripButton)item).BackColor = Main.yellowColor;
}
if (item.GetType() == typeof(ToolStripTextBox))
{
((ToolStripTextBox)item).BackColor = Main.yellowColor; ;
}
else if (item.GetType() == typeof(ToolStripLabel))
{
((ToolStripLabel)item).ForeColor = Color.White;
}
}
}
else if (c.GetType() == typeof(GroupBox))
{
c.ForeColor = Color.White;
foreach (Control gc in c.Controls)
{
if (gc.GetType() == typeof(Label))
{
gc.ForeColor = Color.White;
}
else if (gc.GetType() == typeof(TextBox))
{
gc.BackColor = Main.yellowColor;
}
else if (gc.GetType() == typeof(Button))
{
gc.ForeColor = Color.Black;
gc.BackColor = Main.yellowColor;
}
else if (gc.GetType() == typeof(ComboBox))
{
gc.BackColor = Main.yellowColor;
}
else if (gc.GetType() == typeof(RadioButton))
{
gc.ForeColor = Color.White;
gc.BackColor = Main.brandColor;
}
else if (gc.GetType() == typeof(CheckBox))
{
gc.ForeColor = Color.White;
gc.BackColor = Main.brandColor;
}
else
gc.BackColor = Main.yellowColor;
}
}
}
}
public Main()
{
InitializeComponent();
SetControlsColor(this);
}
private void Main_Load(object sender, EventArgs e)
{
// Set cursor as hourglass
Cursor.Current = Cursors.WaitCursor;
// TODO: Do Something here...
// Set cursor as default arrow
Cursor.Current = Cursors.Default;
}
private void buttonExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void buttonAddCustomers_Click(object sender, EventArgs e)
{
Customers customersForm = new Customers();
customersForm.ShowDialog();
}
private void buttonAddItems_Click(object sender, EventArgs e)
{
Items itemsForm = new Items();
itemsForm.ShowDialog();
}
private void buttonCreateInvoice_Click(object sender, EventArgs e)
{
Invoices invoicesForm = new Invoices();
invoicesForm.ShowDialog();
}
}
}