-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBinaryEntryControlCreater.cs
More file actions
76 lines (68 loc) · 2.44 KB
/
BinaryEntryControlCreater.cs
File metadata and controls
76 lines (68 loc) · 2.44 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
using System.Drawing;
using System.Windows.Forms;
namespace VisualBinaryEditor
{
internal static class BinaryEntryControlCreater
{
internal static readonly Size PanelSize = new Size(677, 50);
internal static readonly Size ValueBoxSize = new Size(210, 30);
internal static Point GetLocation(in int index, in Point offset)
{
int x = 5;
int y = 5 + index * 52;
x += offset.X;
y += offset.Y;
return new Point(x, y);
}
internal static string GetIndexText(in int index)
{
int indexForText = index + 1;
if (indexForText < 10)
{
return indexForText.ToString("00");
}
return indexForText.ToString();
}
internal static void SetAsIndexLabel(this Label indexLabel, in int index)
{
int indexForText = index + 1;
indexLabel.AutoSize = true;
indexLabel.Location = new Point(15, 14);
indexLabel.Name = "indexLabel";
indexLabel.Size = new Size(28, 23);
indexLabel.Text = GetIndexText(index);
}
internal static void SetAsNameLabel(this Label nameLabel)
{
nameLabel.AutoSize = true;
nameLabel.Location = new Point(60, 14);
nameLabel.Name = "nameLabel";
nameLabel.Size = new Size(60, 23);
nameLabel.Text = "Name:";
}
internal static void SetAsNameTextBox(this TextBox nameTextBox)
{
nameTextBox.Location = new Point(120, 10);
nameTextBox.Name = "nameTextBox";
nameTextBox.Size = new Size(150, 30);
nameTextBox.TabIndex = 19;
nameTextBox.Enabled = false;
}
internal static void SetAsTypeLabel(this Label typeLabel, in BinaryType type)
{
typeLabel.AutoSize = true;
typeLabel.Location = new Point(282, 14);
typeLabel.Name = "typeLabel";
typeLabel.Size = new Size(112, 23);
typeLabel.Text = $"Type: {type.ToString().ToLower()}";
}
internal static void SetAsValueLabel(this Label valueLabel)
{
valueLabel.AutoSize = true;
valueLabel.Location = new Point(400, 14);
valueLabel.Name = "valueLabel";
valueLabel.Size = new Size(56, 23);
valueLabel.Text = "Value:";
}
}
}