private void ClearButton_Click(object sender, EventArgs e)
 {
     middle_tiles.Clear();
     inner.Clear();
     CenterPieces.Refresh();
     CornerPieces.Refresh();
     corner_okay = center_okay = UseButton.Enabled = false;
 }
        private void CenterButton_Click(object sender, EventArgs e)
        {
            if (middle_tiles.Count == 9)
            {
                return;
            }
            List <short> indicies = new List <short>(tileset.GetSelectedIndices());

            if (indicies.Count != 0)
            {
                while (indicies.Contains(-1))
                {
                    indicies.Remove(-1);
                }
                middle_tiles.AddRange(indicies);
                while (middle_tiles.Count > 9)
                {
                    middle_tiles.RemoveAt(middle_tiles.Count - 1);
                }
            }
            else
            {
                middle_tiles.Add(tileset.Selection);
            }
            if (middle_tiles.Count == 9)
            {
                center_tile = middle_tiles[4];
                sides.Clear(); corners.Clear(); border.Clear();
                sides.AddRange(new short[4] {
                    middle_tiles[1], middle_tiles[3], middle_tiles[5], middle_tiles[7]
                });
                corners.AddRange(new short[4] {
                    middle_tiles[0], middle_tiles[2], middle_tiles[6], middle_tiles[8]
                });
                border.AddRange(middle_tiles);
                border.RemoveAt(4);
            }
            center_okay       = (middle_tiles.Count == 9);
            UseButton.Enabled = (center_okay && corner_okay);
            CenterPieces.Refresh();
        }
 private void CenterPieces_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     middle_tiles.Clear();
     CenterPieces.Refresh();
     UseButton.Enabled = center_okay = false;
 }