private void label_Click(object sender, EventArgs e) { SudoBlock obj = (SudoBlock)sender; if (LastSelectx != -1) { labels[LastSelectx, LastSelecty].UnSelect(); } obj.UserSelect(); LastSelectx = obj.x; LastSelecty = obj.y; }
private void CreateLabel(int x, int y) { SudoBlock label = new SudoBlock(); label.Location = new Point(36 * x + (x / 3 + 1) * 3 + (x + 1) * 2, 36 * y + (y / 3 + 1) * 3 + (y + 1) * 2); label.x = x; label.y = y; label.Click += new EventHandler(label_Click); label.ForeColor = Color.Black; labels[x, y] = label; Controls.Add(label); }