-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCell.cs
More file actions
106 lines (91 loc) · 2.95 KB
/
Cell.cs
File metadata and controls
106 lines (91 loc) · 2.95 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
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
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Sudoku.NET
{
public class Cell : Button
{
private static List<Color> ColorList = new List<Color>() {
Color.FromArgb(225),
Color.Aqua,
Color.Bisque,
Color.Chocolate,
Color.MediumPurple,
Color.HotPink,
Color.LightSteelBlue,
Color.Thistle,
Color.MediumAquamarine,
Color.YellowGreen
};
const int blink = 100;
const int blink_loop = 2;
private bool settingDataFlag = false;
public int Data
{
get
{
int val;
if (int.TryParse(this.Text, out val))
{
return val;
}
return 0;
}
set
{
if (value > 0)
{
var targetColor = ColorList[value % 10];
//Task.Factory.StartNew(() =>
//{
// settingDataFlag = true;
// this.Text = value.ToString();
// for (int i = 0; i < blink_loop; i++)
// {
// //this.BackColor = Color.LightSalmon;
// this.BackColor = targetColor;
// Thread.Sleep(blink);
// this.BackColor = Color.LemonChiffon;
// Thread.Sleep(blink);
// }
// //this.BackColor = ColorList[value.Value % 10];
// this.BackColor = targetColor;
// settingDataFlag = false;
//});
this.Text = value.ToString();
this.BackColor = targetColor;
}
else
{
//Task.Factory.StartNew(() =>
//{
// for (int i = 0; i < blink_loop; i++)
// {
// if (settingDataFlag == false)
// {
// break;
// }
// Thread.Sleep(blink);
// }
// this.Text = "";
// this.BackColor = ColorList[0];
//});
this.Text = "";
this.BackColor = ColorList[0];
}
}
}
public void SetPosition(int val)
{
Line = (val - val % 10) / 10;
Column = val % 10;
}
public int Line { get; private set; } = 0;
public int Column { get; private set; } = 0;
}
}