-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGridDialog.cs
More file actions
73 lines (62 loc) · 1.75 KB
/
GridDialog.cs
File metadata and controls
73 lines (62 loc) · 1.75 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
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 slidegrid;
public partial class GridDialog : Form
{
public GridDialog()
{
InitializeComponent();
}
internal Grid Grid
{
get
{
var g = new Grid();
_ = int.TryParse(txtX.Text, out var x);
_ = int.TryParse(txtY.Text, out var y);
_ = int.TryParse(txtW.Text, out var w);
_ = int.TryParse(txtH.Text, out var h);
g.Dimensions = new(x, y, w, h);
return g;
}
}
private void txtX_KeyPress(object sender, KeyPressEventArgs e)
{
txtX.ValidateKeyPressInt(e);
}
private void txtX_TextChanged(object sender, EventArgs e)
{
if (!int.TryParse(txtX.Text, out var i)) txtX.Text = string.Empty;
}
private void txtY_KeyPress(object sender, KeyPressEventArgs e)
{
txtY.ValidateKeyPressInt(e);
}
private void txtY_TextChanged(object sender, EventArgs e)
{
if (!int.TryParse(txtY.Text, out var i)) txtY.Text = string.Empty;
}
private void txtW_KeyPress(object sender, KeyPressEventArgs e)
{
txtW.ValidateKeyPressInt(e);
}
private void txtW_TextChanged(object sender, EventArgs e)
{
if (!int.TryParse(txtW.Text, out var i)) txtW.Text = string.Empty;
}
private void txtH_KeyPress(object sender, KeyPressEventArgs e)
{
txtH.ValidateKeyPressInt(e);
}
private void txtH_TextChanged(object sender, EventArgs e)
{
if (!int.TryParse(txtH.Text, out var i)) txtH.Text = string.Empty;
}
}