private void SetColorNeighbourCell(Cage cage, Color color, bool IsHideFocus = false) { if (IsCageGridActive) { foreach (int num in cage.Neighbour) { Cell.OfType <Cage>().Where(a => a.NumName == num).First().BackColor = color; } } if (IsHideFocus) { InvisibleButton.Focus(); } }
//CELL EVENT private void Cage_MouseClick(object sender, MouseEventArgs e) { InvisibleButton.Focus(); if (ActiveButton != null) { ActiveButton.BackColor = Color.LavenderBlush; SetColorNeighbourCell(ActiveButton, Color.LavenderBlush, true); if (ActiveButton.Name == (sender as CageBox).Name) { ShowSimilarCage(ActiveButton, true); ActiveButton = null; return; } } ActiveButton = Cell.OfType <Cage>().Where(a => a.NumName == int.Parse((sender as CageBox).Name.Remove(0, 7))).First(); ActiveCages = Cell.OfType <Cage>().Where(a => a.NumName == ActiveButton.NumName).First().Neighbour.ToArray(); SetColorNeighbourCell(ActiveButton, Color.Pink, false); ShowSimilarCage(ActiveButton); (sender as CageBox).BackColor = Color.HotPink; }
private static Rect GetRemoveButtonRect(Rect r) { Vector2 vector = InvisibleButton.CalcSize(IconRemove); return(new Rect(r.xMax - vector.x, r.y + (int)(r.height / 2f - vector.y / 2f), vector.x, vector.y)); }
private void Unfocus() { InvisibleButton.Focus(); }