-
Notifications
You must be signed in to change notification settings - Fork 0
/
ColorsDialog.cs
79 lines (62 loc) · 1.8 KB
/
ColorsDialog.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
using System;
using System.Windows.Forms;
namespace LangontsAntSimulator
{
public partial class ColorsDialog : BaseForm
{
#region Public Constructors
public ColorsDialog()
{
InitializeComponent();
}
public ColorsDialog(ColorParameters parameters)
: this()
{
taggedBlockLabel.BackColor = parameters.TaggedBlockColor;
untaggedBlockLabel.BackColor = parameters.UntaggedBlockColor;
actorLabel.BackColor = parameters.ActorColor;
}
#endregion Public Constructors
#region Event Handlers
private void actorButton_Click(object sender, EventArgs e)
{
this.ChooseColor(actorLabel);
}
private void cancelButton_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void okButton_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
private void taggedBlockButton_Click(object sender, EventArgs e)
{
this.ChooseColor(taggedBlockLabel);
}
private void untaggedBlockButton_Click(object sender, EventArgs e)
{
this.ChooseColor(untaggedBlockLabel);
}
#endregion Event Handlers
#region Public Methods
public ColorParameters GetColorParameters()
{
return new ColorParameters()
{
ActorColor = actorLabel.BackColor,
UntaggedBlockColor = untaggedBlockLabel.BackColor,
TaggedBlockColor = taggedBlockLabel.BackColor
};
}
#endregion Public Methods
#region Private Methods
private void ChooseColor(Label preview)
{
colorDialog.Color = preview.BackColor;
if (colorDialog.ShowDialog(this) == DialogResult.OK)
preview.BackColor = colorDialog.Color;
}
#endregion Private Methods
}
}