forked from jadaradix/dsgamemaker
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSetCoOrdinates.cs
More file actions
60 lines (52 loc) · 1.68 KB
/
SetCoOrdinates.cs
File metadata and controls
60 lines (52 loc) · 1.68 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
namespace DS_Game_Maker
{
public partial class SetCoOrdinates
{
public short X;
public short Y;
public SetCoOrdinates()
{
InitializeComponent();
}
private void DAcceptButton_Click(object sender, EventArgs e)
{
X = Convert.ToInt16(XTextBox.Text.ToString());
Y = Convert.ToInt16(YTextBox.Text.ToString());
Close();
}
private void SetCoOrdinates_Load(object sender, EventArgs e)
{
XTextBox.Text = X.ToString();
YTextBox.Text = Y.ToString();
}
private void TextBoxs_TextChanged(object sender, EventArgs e)
{
bool Enabled = true;
if (XTextBox.Text.Length == 0 | YTextBox.Text.Length == 0)
return;
byte XCount = 0;
byte YCount = 0;
foreach (string X in DSGMlib.Numbers)
XCount = (byte)(XCount + DSGMlib.HowManyChar(XTextBox.Text, X));
foreach (string Y in DSGMlib.Numbers)
YCount = (byte)(YCount + DSGMlib.HowManyChar(YTextBox.Text, Y));
if (!(XCount == XTextBox.Text.Length))
Enabled = false;
if (!(YCount == YTextBox.Text.Length))
Enabled = false;
DAcceptButton.Enabled = Enabled;
}
private void SetCoOrdinates_Shown(object sender, EventArgs e)
{
XTextBox.Focus();
}
private void XTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
DAcceptButton_Click(new object(), new EventArgs());
}
}
}
}