Click here to Skip to main content
15,882,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have started a c# project to develop an easy board game as a hobby and since there is no pressure I try to improve its design based on the Object Oriented logic. The primary reason is to further develop myself as a programmer and share my thoughts with the community as food for discussion.

What I don't like is the below:

1. The Config references of from the rest classes.
2. The MapFormDesigner that repeats the same things for all the position buttons
3. The bMap.Category = new Category(this._activeCat.Number); of the updateBMapCategory method. The Right Hand Side needs the Number property to be accessible. If it is accessible someone change the bMap.Category.Number directly violating the encapsulation logic which in practise introduces a bug as the updateButton(); will not be called that way.

Any other ideas, suggestions, thoughts of improving the desing of this code are appreciated.
In VB6 I used to create control arrays to handle those cases but in C# this is not so easy to implement.


Here is the lengthy code:

Category.cs
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BoardGame.Classes
{
    public class Category
    {
        private const Byte _empty = Config.CATEGORY_EMPTY;
        private const Byte _min = Config.CATEGORY_MIN;
        private const Byte _max = Config.CATEGORY_MAX;

        private Byte _number;
        public Byte Number
        {
            get 
            {
                return _number;
            }
            set
            {
                setNumber(value);
            }
        }

        public Category()
        {
            setNumber(_empty);
        }

        public Category(Byte number)
        {
            setNumber(number);
        }

        private void setNumber(Byte number) 
        {
            // If the value specified is out of range (min, max) and empty 
            // then assign the empty category
            if (number == _empty || (number >= _min && number <= _max))
            {
                _number = number;
            }
            else
            {
                _number = _empty;
            }
        }

        public Boolean isPopulated() 
        {
            return _number != _empty;
        }

    }
}



Config.cs
C#
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BoardGame.Classes
{
    public static class Config
    {
        public const Byte CATEGORY_EMPTY = 0;
        public const Byte CATEGORY_MIN = 1;
        public const Byte CATEGORY_MAX = 6;

        public const Byte MAP_SIZE_X = 7;
        public const Byte MAP_SIZE_Y = 8;

        public static System.Drawing.Color[] CATEGORY_COLORS = { 
            Color.Gainsboro, 
            Color.Peru, 
            Color.LimeGreen,
            Color.Red,
            Color.Orange,
            Color.Gray,
            Color.SaddleBrown
        };
    }
}


Coordinates.cs
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BoardGame.Classes
{
    public class Coordinates
    {
        private Byte _x;
        public Byte X
        {
            get
            {
                return _x;
            }
        }
        
        private Byte _y;
        public Byte Y
        {
            get
            {
                return _y;
            }
        }

        public Coordinates(Byte x, Byte y)
        {
            _x = x;
            _y = y;
        }
    }
}


GameMap.cs

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BoardGame.Classes;

namespace BoardGame.Classes
{
    class GameMap
    {
        
        private const Byte _mapSizeX = Config.MAP_SIZE_X;
        private const Byte _mapSizeY = Config.MAP_SIZE_Y;
        private const Byte _categoryEmpty = Config.CATEGORY_EMPTY;
        private const Byte _categoryMin = Config.CATEGORY_MIN;
        private const Byte _categoryMax = Config.CATEGORY_MAX;

        private Byte[,] _categories;

        public GameMap() 
        {
            _categories = new Byte[_mapSizeX, _mapSizeY];

            // Initialize with the empty category
            for (int x = 0; x < _mapSizeX; x++)
            {
                for (int y = 0; y < _mapSizeY; y++)
                {
                    _categories[x, y] = _categoryEmpty;
                }
            }
        }

        public void setCategory(Coordinates coordinates, Category category)
        {
            _categories[coordinates.X, coordinates.Y] = category.Number;
        }
    }
}


Program.cs
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

using BoardGame.Forms;

namespace BoardGame.Classes
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MapForm());
        }
    }
}


ColorSelectorButton.cs

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using BoardGame.Classes;

namespace BoardGame.Controls
{
    public partial class ColorSelectorButton : Button
    {
        private const int BOARDER_WIDTH_DEACTIVE = 1;
        private const int BOARDER_WIDTH_ACTIVE = 3;

        private Category _category;
        public Byte CategoryNumber
        {
            get
            {
                return _category.Number;
            }
            set
            {
                _category = new Category(value);
                updateColor();
            }
        }

        public ColorSelectorButton()
        { 
            InitializeComponent();
            _category = new Category();
        }

        public void activate()
        {
            this.FlatAppearance.BorderSize = BOARDER_WIDTH_ACTIVE;
        }

        public void deactivate()
        {
            this.FlatAppearance.BorderSize = BOARDER_WIDTH_DEACTIVE;
        }

        public void updateColor()
        {
            this.BackColor = Config.CATEGORY_COLORS[_category.Number];
        }
    }
}


ColorSelectorButton.Designer.cs
C#
namespace BoardGame.Controls
{
    partial class ColorSelectorButton
    {
        /// <summary> 
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary> 
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary> 
        /// Required method for Designer support - do not modify 
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            components = new System.ComponentModel.Container();
        }

        #endregion
    }
}



MapPositionButton.cs
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using BoardGame.Classes;

namespace BoardGame.Controls
{
    public partial class MapPositionButton : Button
    {
        private Coordinates _coordinates;
        public Coordinates Coordinates
        {
            get
            {
                return _coordinates;
            }
            set
            {
                _coordinates = value;
            }
        }

        private Category _category;
        public Category Category
        {
            get
            {
                return _category;
            }
            set
            {
                _category = value;
                updateButton();
            }
        }

        public MapPositionButton()
        {
            InitializeComponent();
            _category = new Category(Config.CATEGORY_EMPTY);
        }

        private void updateButton()
        {
            this.BackColor = Config.CATEGORY_COLORS[_category.Number];
        }
    }
}


MapPositionButton.Designer.cs
C#
namespace BoardGame.Controls
{
    partial class MapPositionButton
    {
        /// <summary> 
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary> 
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary> 
        /// Required method for Designer support - do not modify 
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            components = new System.ComponentModel.Container();
        }

        #endregion
    }
}


MapForm.cs

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using BoardGame.Controls;
using BoardGame.Classes;

namespace BoardGame.Forms
{
    public partial class MapForm : Form
    {
        private Category _activeCat = new Category(Config.CATEGORY_EMPTY);
        public Category ActiveCat
        {
            get
            {
                return _activeCat;
            }
            set
            {
                _activeCat = value;
                updateCatSelector();
            }
        }

        public MapForm()
        {
            InitializeComponent();
            InitializeCustomControls();
            
            initializeCatSelector();
        }


        private void initializeCatSelector()
        {
            foreach (var b in this.Controls.OfType<ColorSelectorButton>())
            {
                b.updateColor();
            }
        }

        private void updateCatSelector() 
        {
            foreach (var b in this.Controls.OfType<ColorSelectorButton>())
            {
                if (Byte.Equals(b.CategoryNumber, _activeCat))
                {
                    b.activate();
                }
                else
                {
                    b.deactivate();
                }
            }
        }

        # region bCat

        private void bCat0_Click(object sender, EventArgs e)
        {
            updateBCat(sender);
        }

        private void bCat1_Click(object sender, EventArgs e)
        {
            updateBCat(sender);
        }

        private void bCat2_Click(object sender, EventArgs e)
        {
            updateBCat(sender);
        }

        private void bCat3_Click(object sender, EventArgs e)
        {
            updateBCat(sender);
        }

        private void bCat4_Click(object sender, EventArgs e)
        {
            updateBCat(sender);
        }

        private void bCat5_Click(object sender, EventArgs e)
        {
            updateBCat(sender);
        }

        private void bCat6_Click(object sender, EventArgs e)
        {
            updateBCat(sender);
        }
        # endregion

        private void updateBCat(object o)
        {
            var b = o as ColorSelectorButton;
            this.ActiveCat = new Category(b.CategoryNumber);
        }
        
        
        # region bMapPos

        private void bMapPos1_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos2_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos3_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos4_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos5_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos6_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos7_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos8_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos9_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos10_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos11_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos12_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos13_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos14_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos15_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos16_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos17_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos18_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos19_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos20_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos21_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos22_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos23_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos24_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos25_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos26_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos27_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos28_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos29_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos30_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos31_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos32_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos33_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos34_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }
   

        private void bMapPos35_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos36_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos37_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos38_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos39_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos40_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos41_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos42_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos43_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos44_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos45_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos46_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos47_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos48_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos49_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos50_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos51_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos52_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos53_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos54_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos55_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }

        private void bMapPos56_Click(object sender, EventArgs e)
        {
            updateBMapCategory(sender);
        }
        # endregion

        private void updateBMapCategory(object o)
        {
            var bMap = o as MapPositionButton;
            // TODO we should not permit to change the Category Number directly
            // bMap.Category.Number should not be accessible.
            bMap.Category = new Category(this._activeCat.Number);
        }




        private void MapForm_Load(object sender, EventArgs e)
        {

        }

        private void bQuit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

    }
}


MapForm.Designer.cs

C#
using BoardGame.Classes;
using BoardGame.Controls;

namespace BoardGame.Forms
{
    partial class MapForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }


        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            BoardGame.Classes.Category category1 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category2 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category3 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category4 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category5 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category6 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category7 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category8 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category9 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category10 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category11 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category12 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category13 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category14 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category15 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category16 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category17 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category18 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category19 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category20 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category21 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category22 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category23 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category24 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category25 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category26 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category27 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category28 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category29 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category30 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category31 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category32 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category33 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category34 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category35 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category36 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category37 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category38 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category39 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category40 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category41 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category42 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category43 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category44 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category45 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category46 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category47 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category48 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category49 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category50 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category51 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category52 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category53 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category54 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category55 = new BoardGame.Classes.Category();
            BoardGame.Classes.Category category56 = new BoardGame.Classes.Category();
            this.bMapPos1 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos2 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos3 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos4 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos5 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos6 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos7 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos8 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos9 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos10 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos11 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos12 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos13 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos14 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos15 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos16 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos17 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos18 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos19 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos20 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos21 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos22 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos23 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos24 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos25 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos26 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos27 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos28 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos29 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos30 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos31 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos32 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos33 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos34 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos35 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos36 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos37 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos38 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos39 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos40 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos41 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos42 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos43 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos44 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos45 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos46 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos47 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos48 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos49 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos50 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos51 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos52 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos53 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos54 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos55 = new BoardGame.Controls.MapPositionButton();
            this.bMapPos56 = new BoardGame.Controls.MapPositionButton();
            this.bCat0 = new BoardGame.Controls.ColorSelectorButton();
            this.bCat1 = new BoardGame.Controls.ColorSelectorButton();
            this.bCat2 = new BoardGame.Controls.ColorSelectorButton();
            this.bCat3 = new BoardGame.Controls.ColorSelectorButton();
            this.bCat4 = new BoardGame.Controls.ColorSelectorButton();
            this.bCat5 = new BoardGame.Controls.ColorSelectorButton();
            this.bCat6 = new BoardGame.Controls.ColorSelectorButton();
            this.bQuit = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // bMapPos1
            // 
            category1.Number = ((byte)(0));
            this.bMapPos1.Category = category1;
            this.bMapPos1.Coordinates = null;
            this.bMapPos1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos1.Location = new System.Drawing.Point(51, 301);
            this.bMapPos1.Name = "bMapPos1";
            this.bMapPos1.Size = new System.Drawing.Size(36, 36);
            this.bMapPos1.TabIndex = 0;
            this.bMapPos1.UseVisualStyleBackColor = true;
            this.bMapPos1.Click += new System.EventHandler(this.bMapPos1_Click);
            // 
            // bMapPos2
            // 
            category2.Number = ((byte)(0));
            this.bMapPos2.Category = category2;
            this.bMapPos2.Coordinates = null;
            this.bMapPos2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos2.Location = new System.Drawing.Point(89, 301);
            this.bMapPos2.Name = "bMapPos2";
            this.bMapPos2.Size = new System.Drawing.Size(36, 36);
            this.bMapPos2.TabIndex = 1;
            this.bMapPos2.UseVisualStyleBackColor = true;
            this.bMapPos2.Click += new System.EventHandler(this.bMapPos2_Click);
            // 
            // bMapPos3
            // 
            category3.Number = ((byte)(0));
            this.bMapPos3.Category = category3;
            this.bMapPos3.Coordinates = null;
            this.bMapPos3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos3.Location = new System.Drawing.Point(127, 301);
            this.bMapPos3.Name = "bMapPos3";
            this.bMapPos3.Size = new System.Drawing.Size(36, 36);
            this.bMapPos3.TabIndex = 3;
            this.bMapPos3.UseVisualStyleBackColor = true;
            this.bMapPos3.Click += new System.EventHandler(this.bMapPos3_Click);
            // 
            // bMapPos4
            // 
            category4.Number = ((byte)(0));
            this.bMapPos4.Category = category4;
            this.bMapPos4.Coordinates = null;
            this.bMapPos4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos4.Location = new System.Drawing.Point(165, 301);
            this.bMapPos4.Name = "bMapPos4";
            this.bMapPos4.Size = new System.Drawing.Size(36, 36);
            this.bMapPos4.TabIndex = 2;
            this.bMapPos4.UseVisualStyleBackColor = true;
            this.bMapPos4.Click += new System.EventHandler(this.bMapPos4_Click);
            // 
            // bMapPos5
            // 
            category5.Number = ((byte)(0));
            this.bMapPos5.Category = category5;
            this.bMapPos5.Coordinates = null;
            this.bMapPos5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos5.Location = new System.Drawing.Point(203, 301);
            this.bMapPos5.Name = "bMapPos5";
            this.bMapPos5.Size = new System.Drawing.Size(36, 36);
            this.bMapPos5.TabIndex = 7;
            this.bMapPos5.UseVisualStyleBackColor = true;
            this.bMapPos5.Click += new System.EventHandler(this.bMapPos5_Click);
            // 
            // bMapPos6
            // 
            category6.Number = ((byte)(0));
            this.bMapPos6.Category = category6;
            this.bMapPos6.Coordinates = null;
            this.bMapPos6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos6.Location = new System.Drawing.Point(241, 301);
            this.bMapPos6.Name = "bMapPos6";
            this.bMapPos6.Size = new System.Drawing.Size(36, 36);
            this.bMapPos6.TabIndex = 6;
            this.bMapPos6.UseVisualStyleBackColor = true;
            this.bMapPos6.Click += new System.EventHandler(this.bMapPos6_Click);
            // 
            // bMapPos7
            // 
            category7.Number = ((byte)(0));
            this.bMapPos7.Category = category7;
            this.bMapPos7.Coordinates = null;
            this.bMapPos7.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos7.Location = new System.Drawing.Point(279, 301);
            this.bMapPos7.Name = "bMapPos7";
            this.bMapPos7.Size = new System.Drawing.Size(36, 36);
            this.bMapPos7.TabIndex = 5;
            this.bMapPos7.UseVisualStyleBackColor = true;
            this.bMapPos7.Click += new System.EventHandler(this.bMapPos7_Click);
            // 
            // bMapPos8
            // 
            category8.Number = ((byte)(0));
            this.bMapPos8.Category = category8;
            this.bMapPos8.Coordinates = null;
            this.bMapPos8.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos8.Location = new System.Drawing.Point(51, 263);
            this.bMapPos8.Name = "bMapPos8";
            this.bMapPos8.Size = new System.Drawing.Size(36, 36);
            this.bMapPos8.TabIndex = 4;
            this.bMapPos8.UseVisualStyleBackColor = true;
            this.bMapPos8.Click += new System.EventHandler(this.bMapPos8_Click);
            // 
            // bMapPos9
            // 
            category9.Number = ((byte)(0));
            this.bMapPos9.Category = category9;
            this.bMapPos9.Coordinates = null;
            this.bMapPos9.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos9.Location = new System.Drawing.Point(89, 263);
            this.bMapPos9.Name = "bMapPos9";
            this.bMapPos9.Size = new System.Drawing.Size(36, 36);
            this.bMapPos9.TabIndex = 13;
            this.bMapPos9.UseVisualStyleBackColor = true;
            this.bMapPos9.Click += new System.EventHandler(this.bMapPos9_Click);
            // 
            // bMapPos10
            // 
            category10.Number = ((byte)(0));
            this.bMapPos10.Category = category10;
            this.bMapPos10.Coordinates = null;
            this.bMapPos10.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos10.Location = new System.Drawing.Point(127, 263);
            this.bMapPos10.Name = "bMapPos10";
            this.bMapPos10.Size = new System.Drawing.Size(36, 36);
            this.bMapPos10.TabIndex = 12;
            this.bMapPos10.UseVisualStyleBackColor = true;
            this.bMapPos10.Click += new System.EventHandler(this.bMapPos10_Click);
            // 
            // bMapPos11
            // 
            category11.Number = ((byte)(0));
            this.bMapPos11.Category = category11;
            this.bMapPos11.Coordinates = null;
            this.bMapPos11.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos11.Location = new System.Drawing.Point(165, 263);
            this.bMapPos11.Name = "bMapPos11";
            this.bMapPos11.Size = new System.Drawing.Size(36, 36);
            this.bMapPos11.TabIndex = 11;
            this.bMapPos11.UseVisualStyleBackColor = true;
            this.bMapPos11.Click += new System.EventHandler(this.bMapPos11_Click);
            // 
            // bMapPos12
            // 
            category12.Number = ((byte)(0));
            this.bMapPos12.Category = category12;
            this.bMapPos12.Coordinates = null;
            this.bMapPos12.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos12.Location = new System.Drawing.Point(203, 263);
            this.bMapPos12.Name = "bMapPos12";
            this.bMapPos12.Size = new System.Drawing.Size(36, 36);
            this.bMapPos12.TabIndex = 10;
            this.bMapPos12.UseVisualStyleBackColor = true;
            this.bMapPos12.Click += new System.EventHandler(this.bMapPos12_Click);
            // 
            // bMapPos13
            // 
            category13.Number = ((byte)(0));
            this.bMapPos13.Category = category13;
            this.bMapPos13.Coordinates = null;
            this.bMapPos13.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos13.Location = new System.Drawing.Point(241, 263);
            this.bMapPos13.Name = "bMapPos13";
            this.bMapPos13.Size = new System.Drawing.Size(36, 36);
            this.bMapPos13.TabIndex = 9;
            this.bMapPos13.UseVisualStyleBackColor = true;
            this.bMapPos13.Click += new System.EventHandler(this.bMapPos13_Click);
            // 
            // bMapPos14
            // 
            category14.Number = ((byte)(0));
            this.bMapPos14.Category = category14;
            this.bMapPos14.Coordinates = null;
            this.bMapPos14.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos14.Location = new System.Drawing.Point(279, 263);
            this.bMapPos14.Name = "bMapPos14";
            this.bMapPos14.Size = new System.Drawing.Size(36, 36);
            this.bMapPos14.TabIndex = 8;
            this.bMapPos14.UseVisualStyleBackColor = true;
            this.bMapPos14.Click += new System.EventHandler(this.bMapPos14_Click);
            // 
            // bMapPos15
            // 
            category15.Number = ((byte)(0));
            this.bMapPos15.Category = category15;
            this.bMapPos15.Coordinates = null;
            this.bMapPos15.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos15.Location = new System.Drawing.Point(51, 225);
            this.bMapPos15.Name = "bMapPos15";
            this.bMapPos15.Size = new System.Drawing.Size(36, 36);
            this.bMapPos15.TabIndex = 20;
            this.bMapPos15.UseVisualStyleBackColor = true;
            this.bMapPos15.Click += new System.EventHandler(this.bMapPos15_Click);
            // 
            // bMapPos16
            // 
            category16.Number = ((byte)(0));
            this.bMapPos16.Category = category16;
            this.bMapPos16.Coordinates = null;
            this.bMapPos16.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos16.Location = new System.Drawing.Point(89, 225);
            this.bMapPos16.Name = "bMapPos16";
            this.bMapPos16.Size = new System.Drawing.Size(36, 36);
            this.bMapPos16.TabIndex = 19;
            this.bMapPos16.UseVisualStyleBackColor = true;
            this.bMapPos16.Click += new System.EventHandler(this.bMapPos16_Click);
            // 
            // bMapPos17
            // 
            category17.Number = ((byte)(0));
            this.bMapPos17.Category = category17;
            this.bMapPos17.Coordinates = null;
            this.bMapPos17.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos17.Location = new System.Drawing.Point(127, 225);
            this.bMapPos17.Name = "bMapPos17";
            this.bMapPos17.Size = new System.Drawing.Size(36, 36);
            this.bMapPos17.TabIndex = 18;
            this.bMapPos17.UseVisualStyleBackColor = true;
            this.bMapPos17.Click += new System.EventHandler(this.bMapPos17_Click);
            // 
            // bMapPos18
            // 
            category18.Number = ((byte)(0));
            this.bMapPos18.Category = category18;
            this.bMapPos18.Coordinates = null;
            this.bMapPos18.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos18.Location = new System.Drawing.Point(165, 225);
            this.bMapPos18.Name = "bMapPos18";
            this.bMapPos18.Size = new System.Drawing.Size(36, 36);
            this.bMapPos18.TabIndex = 17;
            this.bMapPos18.UseVisualStyleBackColor = true;
            this.bMapPos18.Click += new System.EventHandler(this.bMapPos18_Click);
            // 
            // bMapPos19
            // 
            category19.Number = ((byte)(0));
            this.bMapPos19.Category = category19;
            this.bMapPos19.Coordinates = null;
            this.bMapPos19.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos19.Location = new System.Drawing.Point(203, 225);
            this.bMapPos19.Name = "bMapPos19";
            this.bMapPos19.Size = new System.Drawing.Size(36, 36);
            this.bMapPos19.TabIndex = 16;
            this.bMapPos19.UseVisualStyleBackColor = true;
            this.bMapPos19.Click += new System.EventHandler(this.bMapPos19_Click);
            // 
            // bMapPos20
            // 
            category20.Number = ((byte)(0));
            this.bMapPos20.Category = category20;
            this.bMapPos20.Coordinates = null;
            this.bMapPos20.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos20.Location = new System.Drawing.Point(241, 225);
            this.bMapPos20.Name = "bMapPos20";
            this.bMapPos20.Size = new System.Drawing.Size(36, 36);
            this.bMapPos20.TabIndex = 15;
            this.bMapPos20.UseVisualStyleBackColor = true;
            this.bMapPos20.Click += new System.EventHandler(this.bMapPos20_Click);
            // 
            // bMapPos21
            // 
            category21.Number = ((byte)(0));
            this.bMapPos21.Category = category21;
            this.bMapPos21.Coordinates = null;
            this.bMapPos21.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos21.Location = new System.Drawing.Point(279, 225);
            this.bMapPos21.Name = "bMapPos21";
            this.bMapPos21.Size = new System.Drawing.Size(36, 36);
            this.bMapPos21.TabIndex = 14;
            this.bMapPos21.UseVisualStyleBackColor = true;
            this.bMapPos21.Click += new System.EventHandler(this.bMapPos21_Click);
            // 
            // bMapPos22
            // 
            category22.Number = ((byte)(0));
            this.bMapPos22.Category = category22;
            this.bMapPos22.Coordinates = null;
            this.bMapPos22.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos22.Location = new System.Drawing.Point(51, 187);
            this.bMapPos22.Name = "bMapPos22";
            this.bMapPos22.Size = new System.Drawing.Size(36, 36);
            this.bMapPos22.TabIndex = 27;
            this.bMapPos22.UseVisualStyleBackColor = true;
            this.bMapPos22.Click += new System.EventHandler(this.bMapPos22_Click);
            // 
            // bMapPos23
            // 
            category23.Number = ((byte)(0));
            this.bMapPos23.Category = category23;
            this.bMapPos23.Coordinates = null;
            this.bMapPos23.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos23.Location = new System.Drawing.Point(89, 187);
            this.bMapPos23.Name = "bMapPos23";
            this.bMapPos23.Size = new System.Drawing.Size(36, 36);
            this.bMapPos23.TabIndex = 26;
            this.bMapPos23.UseVisualStyleBackColor = true;
            this.bMapPos23.Click += new System.EventHandler(this.bMapPos23_Click);
            // 
            // bMapPos24
            // 
            category24.Number = ((byte)(0));
            this.bMapPos24.Category = category24;
            this.bMapPos24.Coordinates = null;
            this.bMapPos24.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos24.Location = new System.Drawing.Point(127, 187);
            this.bMapPos24.Name = "bMapPos24";
            this.bMapPos24.Size = new System.Drawing.Size(36, 36);
            this.bMapPos24.TabIndex = 25;
            this.bMapPos24.UseVisualStyleBackColor = true;
            this.bMapPos24.Click += new System.EventHandler(this.bMapPos24_Click);
            // 
            // bMapPos25
            // 
            category25.Number = ((byte)(0));
            this.bMapPos25.Category = category25;
            this.bMapPos25.Coordinates = null;
            this.bMapPos25.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos25.Location = new System.Drawing.Point(165, 187);
            this.bMapPos25.Name = "bMapPos25";
            this.bMapPos25.Size = new System.Drawing.Size(36, 36);
            this.bMapPos25.TabIndex = 24;
            this.bMapPos25.UseVisualStyleBackColor = true;
            this.bMapPos25.Click += new System.EventHandler(this.bMapPos25_Click);
            // 
            // bMapPos26
            // 
            category26.Number = ((byte)(0));
            this.bMapPos26.Category = category26;
            this.bMapPos26.Coordinates = null;
            this.bMapPos26.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos26.Location = new System.Drawing.Point(203, 187);
            this.bMapPos26.Name = "bMapPos26";
            this.bMapPos26.Size = new System.Drawing.Size(36, 36);
            this.bMapPos26.TabIndex = 23;
            this.bMapPos26.UseVisualStyleBackColor = true;
            this.bMapPos26.Click += new System.EventHandler(this.bMapPos26_Click);
            // 
            // bMapPos27
            // 
            category27.Number = ((byte)(0));
            this.bMapPos27.Category = category27;
            this.bMapPos27.Coordinates = null;
            this.bMapPos27.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos27.Location = new System.Drawing.Point(241, 187);
            this.bMapPos27.Name = "bMapPos27";
            this.bMapPos27.Size = new System.Drawing.Size(36, 36);
            this.bMapPos27.TabIndex = 22;
            this.bMapPos27.UseVisualStyleBackColor = true;
            this.bMapPos27.Click += new System.EventHandler(this.bMapPos27_Click);
            // 
            // bMapPos28
            // 
            category28.Number = ((byte)(0));
            this.bMapPos28.Category = category28;
            this.bMapPos28.Coordinates = null;
            this.bMapPos28.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos28.Location = new System.Drawing.Point(279, 187);
            this.bMapPos28.Name = "bMapPos28";
            this.bMapPos28.Size = new System.Drawing.Size(36, 36);
            this.bMapPos28.TabIndex = 21;
            this.bMapPos28.UseVisualStyleBackColor = true;
            this.bMapPos28.Click += new System.EventHandler(this.bMapPos28_Click);
            // 
            // bMapPos29
            // 
            category29.Number = ((byte)(0));
            this.bMapPos29.Category = category29;
            this.bMapPos29.Coordinates = null;
            this.bMapPos29.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos29.Location = new System.Drawing.Point(51, 149);
            this.bMapPos29.Name = "bMapPos29";
            this.bMapPos29.Size = new System.Drawing.Size(36, 36);
            this.bMapPos29.TabIndex = 34;
            this.bMapPos29.UseVisualStyleBackColor = true;
            this.bMapPos29.Click += new System.EventHandler(this.bMapPos29_Click);
            // 
            // bMapPos30
            // 
            category30.Number = ((byte)(0));
            this.bMapPos30.Category = category30;
            this.bMapPos30.Coordinates = null;
            this.bMapPos30.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos30.Location = new System.Drawing.Point(89, 149);
            this.bMapPos30.Name = "bMapPos30";
            this.bMapPos30.Size = new System.Drawing.Size(36, 36);
            this.bMapPos30.TabIndex = 33;
            this.bMapPos30.UseVisualStyleBackColor = true;
            this.bMapPos30.Click += new System.EventHandler(this.bMapPos30_Click);
            // 
            // bMapPos31
            // 
            category31.Number = ((byte)(0));
            this.bMapPos31.Category = category31;
            this.bMapPos31.Coordinates = null;
            this.bMapPos31.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos31.Location = new System.Drawing.Point(127, 149);
            this.bMapPos31.Name = "bMapPos31";
            this.bMapPos31.Size = new System.Drawing.Size(36, 36);
            this.bMapPos31.TabIndex = 32;
            this.bMapPos31.UseVisualStyleBackColor = true;
            this.bMapPos31.Click += new System.EventHandler(this.bMapPos31_Click);
            // 
            // bMapPos32
            // 
            category32.Number = ((byte)(0));
            this.bMapPos32.Category = category32;
            this.bMapPos32.Coordinates = null;
            this.bMapPos32.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos32.Location = new System.Drawing.Point(165, 149);
            this.bMapPos32.Name = "bMapPos32";
            this.bMapPos32.Size = new System.Drawing.Size(36, 36);
            this.bMapPos32.TabIndex = 31;
            this.bMapPos32.UseVisualStyleBackColor = true;
            this.bMapPos32.Click += new System.EventHandler(this.bMapPos32_Click);
            // 
            // bMapPos33
            // 
            category33.Number = ((byte)(0));
            this.bMapPos33.Category = category33;
            this.bMapPos33.Coordinates = null;
            this.bMapPos33.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos33.Location = new System.Drawing.Point(203, 149);
            this.bMapPos33.Name = "bMapPos33";
            this.bMapPos33.Size = new System.Drawing.Size(36, 36);
            this.bMapPos33.TabIndex = 30;
            this.bMapPos33.UseVisualStyleBackColor = true;
            this.bMapPos33.Click += new System.EventHandler(this.bMapPos33_Click);
            // 
            // bMapPos34
            // 
            category34.Number = ((byte)(0));
            this.bMapPos34.Category = category34;
            this.bMapPos34.Coordinates = null;
            this.bMapPos34.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos34.Location = new System.Drawing.Point(241, 149);
            this.bMapPos34.Name = "bMapPos34";
            this.bMapPos34.Size = new System.Drawing.Size(36, 36);
            this.bMapPos34.TabIndex = 29;
            this.bMapPos34.UseVisualStyleBackColor = true;
            this.bMapPos34.Click += new System.EventHandler(this.bMapPos34_Click);
            // 
            // bMapPos35
            // 
            category35.Number = ((byte)(0));
            this.bMapPos35.Category = category35;
            this.bMapPos35.Coordinates = null;
            this.bMapPos35.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos35.Location = new System.Drawing.Point(279, 149);
            this.bMapPos35.Name = "bMapPos35";
            this.bMapPos35.Size = new System.Drawing.Size(36, 36);
            this.bMapPos35.TabIndex = 28;
            this.bMapPos35.UseVisualStyleBackColor = true;
            this.bMapPos35.Click += new System.EventHandler(this.bMapPos35_Click);
            // 
            // bMapPos36
            // 
            category36.Number = ((byte)(0));
            this.bMapPos36.Category = category36;
            this.bMapPos36.Coordinates = null;
            this.bMapPos36.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos36.Location = new System.Drawing.Point(51, 111);
            this.bMapPos36.Name = "bMapPos36";
            this.bMapPos36.Size = new System.Drawing.Size(36, 36);
            this.bMapPos36.TabIndex = 41;
            this.bMapPos36.UseVisualStyleBackColor = true;
            this.bMapPos36.Click += new System.EventHandler(this.bMapPos36_Click);
            // 
            // bMapPos37
            // 
            category37.Number = ((byte)(0));
            this.bMapPos37.Category = category37;
            this.bMapPos37.Coordinates = null;
            this.bMapPos37.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos37.Location = new System.Drawing.Point(89, 111);
            this.bMapPos37.Name = "bMapPos37";
            this.bMapPos37.Size = new System.Drawing.Size(36, 36);
            this.bMapPos37.TabIndex = 40;
            this.bMapPos37.UseVisualStyleBackColor = true;
            this.bMapPos37.Click += new System.EventHandler(this.bMapPos37_Click);
            // 
            // bMapPos38
            // 
            category38.Number = ((byte)(0));
            this.bMapPos38.Category = category38;
            this.bMapPos38.Coordinates = null;
            this.bMapPos38.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos38.Location = new System.Drawing.Point(127, 111);
            this.bMapPos38.Name = "bMapPos38";
            this.bMapPos38.Size = new System.Drawing.Size(36, 36);
            this.bMapPos38.TabIndex = 39;
            this.bMapPos38.UseVisualStyleBackColor = true;
            this.bMapPos38.Click += new System.EventHandler(this.bMapPos38_Click);
            // 
            // bMapPos39
            // 
            category39.Number = ((byte)(0));
            this.bMapPos39.Category = category39;
            this.bMapPos39.Coordinates = null;
            this.bMapPos39.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos39.Location = new System.Drawing.Point(165, 111);
            this.bMapPos39.Name = "bMapPos39";
            this.bMapPos39.Size = new System.Drawing.Size(36, 36);
            this.bMapPos39.TabIndex = 38;
            this.bMapPos39.UseVisualStyleBackColor = true;
            this.bMapPos39.Click += new System.EventHandler(this.bMapPos39_Click);
            // 
            // bMapPos40
            // 
            category40.Number = ((byte)(0));
            this.bMapPos40.Category = category40;
            this.bMapPos40.Coordinates = null;
            this.bMapPos40.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos40.Location = new System.Drawing.Point(203, 111);
            this.bMapPos40.Name = "bMapPos40";
            this.bMapPos40.Size = new System.Drawing.Size(36, 36);
            this.bMapPos40.TabIndex = 37;
            this.bMapPos40.UseVisualStyleBackColor = true;
            this.bMapPos40.Click += new System.EventHandler(this.bMapPos40_Click);
            // 
            // bMapPos41
            // 
            category41.Number = ((byte)(0));
            this.bMapPos41.Category = category41;
            this.bMapPos41.Coordinates = null;
            this.bMapPos41.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos41.Location = new System.Drawing.Point(241, 111);
            this.bMapPos41.Name = "bMapPos41";
            this.bMapPos41.Size = new System.Drawing.Size(36, 36);
            this.bMapPos41.TabIndex = 36;
            this.bMapPos41.UseVisualStyleBackColor = true;
            this.bMapPos41.Click += new System.EventHandler(this.bMapPos41_Click);
            // 
            // bMapPos42
            // 
            category42.Number = ((byte)(0));
            this.bMapPos42.Category = category42;
            this.bMapPos42.Coordinates = null;
            this.bMapPos42.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos42.Location = new System.Drawing.Point(279, 111);
            this.bMapPos42.Name = "bMapPos42";
            this.bMapPos42.Size = new System.Drawing.Size(36, 36);
            this.bMapPos42.TabIndex = 35;
            this.bMapPos42.UseVisualStyleBackColor = true;
            this.bMapPos42.Click += new System.EventHandler(this.bMapPos42_Click);
            // 
            // bMapPos43
            // 
            category43.Number = ((byte)(0));
            this.bMapPos43.Category = category43;
            this.bMapPos43.Coordinates = null;
            this.bMapPos43.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos43.Location = new System.Drawing.Point(51, 73);
            this.bMapPos43.Name = "bMapPos43";
            this.bMapPos43.Size = new System.Drawing.Size(36, 36);
            this.bMapPos43.TabIndex = 48;
            this.bMapPos43.UseVisualStyleBackColor = true;
            this.bMapPos43.Click += new System.EventHandler(this.bMapPos43_Click);
            // 
            // bMapPos44
            // 
            category44.Number = ((byte)(0));
            this.bMapPos44.Category = category44;
            this.bMapPos44.Coordinates = null;
            this.bMapPos44.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos44.Location = new System.Drawing.Point(89, 73);
            this.bMapPos44.Name = "bMapPos44";
            this.bMapPos44.Size = new System.Drawing.Size(36, 36);
            this.bMapPos44.TabIndex = 47;
            this.bMapPos44.UseVisualStyleBackColor = true;
            this.bMapPos44.Click += new System.EventHandler(this.bMapPos44_Click);
            // 
            // bMapPos45
            // 
            category45.Number = ((byte)(0));
            this.bMapPos45.Category = category45;
            this.bMapPos45.Coordinates = null;
            this.bMapPos45.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos45.Location = new System.Drawing.Point(127, 73);
            this.bMapPos45.Name = "bMapPos45";
            this.bMapPos45.Size = new System.Drawing.Size(36, 36);
            this.bMapPos45.TabIndex = 46;
            this.bMapPos45.UseVisualStyleBackColor = true;
            this.bMapPos45.Click += new System.EventHandler(this.bMapPos45_Click);
            // 
            // bMapPos46
            // 
            category46.Number = ((byte)(0));
            this.bMapPos46.Category = category46;
            this.bMapPos46.Coordinates = null;
            this.bMapPos46.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos46.Location = new System.Drawing.Point(165, 73);
            this.bMapPos46.Name = "bMapPos46";
            this.bMapPos46.Size = new System.Drawing.Size(36, 36);
            this.bMapPos46.TabIndex = 45;
            this.bMapPos46.UseVisualStyleBackColor = true;
            this.bMapPos46.Click += new System.EventHandler(this.bMapPos46_Click);
            // 
            // bMapPos47
            // 
            category47.Number = ((byte)(0));
            this.bMapPos47.Category = category47;
            this.bMapPos47.Coordinates = null;
            this.bMapPos47.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos47.Location = new System.Drawing.Point(203, 73);
            this.bMapPos47.Name = "bMapPos47";
            this.bMapPos47.Size = new System.Drawing.Size(36, 36);
            this.bMapPos47.TabIndex = 44;
            this.bMapPos47.UseVisualStyleBackColor = true;
            this.bMapPos47.Click += new System.EventHandler(this.bMapPos47_Click);
            // 
            // bMapPos48
            // 
            category48.Number = ((byte)(0));
            this.bMapPos48.Category = category48;
            this.bMapPos48.Coordinates = null;
            this.bMapPos48.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos48.Location = new System.Drawing.Point(241, 73);
            this.bMapPos48.Name = "bMapPos48";
            this.bMapPos48.Size = new System.Drawing.Size(36, 36);
            this.bMapPos48.TabIndex = 43;
            this.bMapPos48.UseVisualStyleBackColor = true;
            this.bMapPos48.Click += new System.EventHandler(this.bMapPos48_Click);
            // 
            // bMapPos49
            // 
            category49.Number = ((byte)(0));
            this.bMapPos49.Category = category49;
            this.bMapPos49.Coordinates = null;
            this.bMapPos49.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos49.Location = new System.Drawing.Point(279, 73);
            this.bMapPos49.Name = "bMapPos49";
            this.bMapPos49.Size = new System.Drawing.Size(36, 36);
            this.bMapPos49.TabIndex = 42;
            this.bMapPos49.UseVisualStyleBackColor = true;
            this.bMapPos49.Click += new System.EventHandler(this.bMapPos49_Click);
            // 
            // bMapPos50
            // 
            category50.Number = ((byte)(0));
            this.bMapPos50.Category = category50;
            this.bMapPos50.Coordinates = null;
            this.bMapPos50.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos50.Location = new System.Drawing.Point(51, 35);
            this.bMapPos50.Name = "bMapPos50";
            this.bMapPos50.Size = new System.Drawing.Size(36, 36);
            this.bMapPos50.TabIndex = 55;
            this.bMapPos50.UseVisualStyleBackColor = true;
            this.bMapPos50.Click += new System.EventHandler(this.bMapPos50_Click);
            // 
            // bMapPos51
            // 
            category51.Number = ((byte)(0));
            this.bMapPos51.Category = category51;
            this.bMapPos51.Coordinates = null;
            this.bMapPos51.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos51.Location = new System.Drawing.Point(89, 35);
            this.bMapPos51.Name = "bMapPos51";
            this.bMapPos51.Size = new System.Drawing.Size(36, 36);
            this.bMapPos51.TabIndex = 54;
            this.bMapPos51.UseVisualStyleBackColor = true;
            this.bMapPos51.Click += new System.EventHandler(this.bMapPos51_Click);
            // 
            // bMapPos52
            // 
            category52.Number = ((byte)(0));
            this.bMapPos52.Category = category52;
            this.bMapPos52.Coordinates = null;
            this.bMapPos52.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos52.Location = new System.Drawing.Point(127, 35);
            this.bMapPos52.Name = "bMapPos52";
            this.bMapPos52.Size = new System.Drawing.Size(36, 36);
            this.bMapPos52.TabIndex = 53;
            this.bMapPos52.UseVisualStyleBackColor = true;
            this.bMapPos52.Click += new System.EventHandler(this.bMapPos52_Click);
            // 
            // bMapPos53
            // 
            category53.Number = ((byte)(0));
            this.bMapPos53.Category = category53;
            this.bMapPos53.Coordinates = null;
            this.bMapPos53.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos53.Location = new System.Drawing.Point(165, 35);
            this.bMapPos53.Name = "bMapPos53";
            this.bMapPos53.Size = new System.Drawing.Size(36, 36);
            this.bMapPos53.TabIndex = 52;
            this.bMapPos53.UseVisualStyleBackColor = true;
            this.bMapPos53.Click += new System.EventHandler(this.bMapPos53_Click);
            // 
            // bMapPos54
            // 
            category54.Number = ((byte)(0));
            this.bMapPos54.Category = category54;
            this.bMapPos54.Coordinates = null;
            this.bMapPos54.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos54.Location = new System.Drawing.Point(203, 35);
            this.bMapPos54.Name = "bMapPos54";
            this.bMapPos54.Size = new System.Drawing.Size(36, 36);
            this.bMapPos54.TabIndex = 51;
            this.bMapPos54.UseVisualStyleBackColor = true;
            this.bMapPos54.Click += new System.EventHandler(this.bMapPos54_Click);
            // 
            // bMapPos55
            // 
            category55.Number = ((byte)(0));
            this.bMapPos55.Category = category55;
            this.bMapPos55.Coordinates = null;
            this.bMapPos55.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos55.Location = new System.Drawing.Point(241, 35);
            this.bMapPos55.Name = "bMapPos55";
            this.bMapPos55.Size = new System.Drawing.Size(36, 36);
            this.bMapPos55.TabIndex = 50;
            this.bMapPos55.UseVisualStyleBackColor = true;
            this.bMapPos55.Click += new System.EventHandler(this.bMapPos55_Click);
            // 
            // bMapPos56
            // 
            category56.Number = ((byte)(0));
            this.bMapPos56.Category = category56;
            this.bMapPos56.Coordinates = null;
            this.bMapPos56.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bMapPos56.Location = new System.Drawing.Point(279, 35);
            this.bMapPos56.Name = "bMapPos56";
            this.bMapPos56.Size = new System.Drawing.Size(36, 36);
            this.bMapPos56.TabIndex = 49;
            this.bMapPos56.UseVisualStyleBackColor = true;
            this.bMapPos56.Click += new System.EventHandler(this.bMapPos56_Click);
            // 
            // bCat0
            // 
            this.bCat0.BackColor = System.Drawing.Color.Gainsboro;
            this.bCat0.CategoryNumber = ((byte)(0));
            this.bCat0.FlatAppearance.BorderColor = System.Drawing.Color.Black;
            this.bCat0.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bCat0.Location = new System.Drawing.Point(51, 359);
            this.bCat0.Name = "bCat0";
            this.bCat0.Size = new System.Drawing.Size(36, 36);
            this.bCat0.TabIndex = 62;
            this.bCat0.Text = "X";
            this.bCat0.UseVisualStyleBackColor = false;
            this.bCat0.Click += new System.EventHandler(this.bCat0_Click);
            // 
            // bCat1
            // 
            this.bCat1.BackColor = System.Drawing.Color.Peru;
            this.bCat1.CategoryNumber = ((byte)(1));
            this.bCat1.FlatAppearance.BorderColor = System.Drawing.Color.Black;
            this.bCat1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bCat1.Location = new System.Drawing.Point(89, 359);
            this.bCat1.Name = "bCat1";
            this.bCat1.Size = new System.Drawing.Size(36, 36);
            this.bCat1.TabIndex = 56;
            this.bCat1.UseVisualStyleBackColor = false;
            this.bCat1.Click += new System.EventHandler(this.bCat1_Click);
            // 
            // bCat2
            // 
            this.bCat2.BackColor = System.Drawing.Color.LimeGreen;
            this.bCat2.CategoryNumber = ((byte)(2));
            this.bCat2.FlatAppearance.BorderColor = System.Drawing.Color.Black;
            this.bCat2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bCat2.Location = new System.Drawing.Point(127, 359);
            this.bCat2.Name = "bCat2";
            this.bCat2.Size = new System.Drawing.Size(36, 36);
            this.bCat2.TabIndex = 57;
            this.bCat2.UseVisualStyleBackColor = false;
            this.bCat2.Click += new System.EventHandler(this.bCat2_Click);
            // 
            // bCat3
            // 
            this.bCat3.BackColor = System.Drawing.Color.Red;
            this.bCat3.CategoryNumber = ((byte)(3));
            this.bCat3.FlatAppearance.BorderColor = System.Drawing.Color.Black;
            this.bCat3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bCat3.Location = new System.Drawing.Point(165, 359);
            this.bCat3.Name = "bCat3";
            this.bCat3.Size = new System.Drawing.Size(36, 36);
            this.bCat3.TabIndex = 58;
            this.bCat3.UseVisualStyleBackColor = false;
            this.bCat3.Click += new System.EventHandler(this.bCat3_Click);
            // 
            // bCat4
            // 
            this.bCat4.BackColor = System.Drawing.Color.Orange;
            this.bCat4.CategoryNumber = ((byte)(4));
            this.bCat4.FlatAppearance.BorderColor = System.Drawing.Color.Black;
            this.bCat4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bCat4.Location = new System.Drawing.Point(203, 359);
            this.bCat4.Name = "bCat4";
            this.bCat4.Size = new System.Drawing.Size(36, 36);
            this.bCat4.TabIndex = 59;
            this.bCat4.UseVisualStyleBackColor = false;
            this.bCat4.Click += new System.EventHandler(this.bCat4_Click);
            // 
            // bCat5
            // 
            this.bCat5.BackColor = System.Drawing.Color.Gray;
            this.bCat5.CategoryNumber = ((byte)(5));
            this.bCat5.FlatAppearance.BorderColor = System.Drawing.Color.Black;
            this.bCat5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bCat5.Location = new System.Drawing.Point(241, 359);
            this.bCat5.Name = "bCat5";
            this.bCat5.Size = new System.Drawing.Size(36, 36);
            this.bCat5.TabIndex = 60;
            this.bCat5.UseVisualStyleBackColor = false;
            this.bCat5.Click += new System.EventHandler(this.bCat5_Click);
            // 
            // bCat6
            // 
            this.bCat6.BackColor = System.Drawing.Color.SaddleBrown;
            this.bCat6.CategoryNumber = ((byte)(6));
            this.bCat6.FlatAppearance.BorderColor = System.Drawing.Color.Black;
            this.bCat6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bCat6.Location = new System.Drawing.Point(279, 359);
            this.bCat6.Name = "bCat6";
            this.bCat6.Size = new System.Drawing.Size(36, 36);
            this.bCat6.TabIndex = 61;
            this.bCat6.UseVisualStyleBackColor = false;
            this.bCat6.Click += new System.EventHandler(this.bCat6_Click);
            // 
            // bQuit
            // 
            this.bQuit.Location = new System.Drawing.Point(51, 424);
            this.bQuit.Name = "bQuit";
            this.bQuit.Size = new System.Drawing.Size(74, 34);
            this.bQuit.TabIndex = 64;
            this.bQuit.Text = "Quit";
            this.bQuit.UseVisualStyleBackColor = true;
            this.bQuit.Click += new System.EventHandler(this.bQuit_Click);
            // 
            // MapForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(365, 488);
            this.Controls.Add(this.bQuit);
            this.Controls.Add(this.bCat0);
            this.Controls.Add(this.bCat6);
            this.Controls.Add(this.bCat5);
            this.Controls.Add(this.bCat4);
            this.Controls.Add(this.bCat3);
            this.Controls.Add(this.bCat2);
            this.Controls.Add(this.bCat1);
            this.Controls.Add(this.bMapPos50);
            this.Controls.Add(this.bMapPos51);
            this.Controls.Add(this.bMapPos52);
            this.Controls.Add(this.bMapPos53);
            this.Controls.Add(this.bMapPos54);
            this.Controls.Add(this.bMapPos55);
            this.Controls.Add(this.bMapPos56);
            this.Controls.Add(this.bMapPos43);
            this.Controls.Add(this.bMapPos44);
            this.Controls.Add(this.bMapPos45);
            this.Controls.Add(this.bMapPos46);
            this.Controls.Add(this.bMapPos47);
            this.Controls.Add(this.bMapPos48);
            this.Controls.Add(this.bMapPos49);
            this.Controls.Add(this.bMapPos36);
            this.Controls.Add(this.bMapPos37);
            this.Controls.Add(this.bMapPos38);
            this.Controls.Add(this.bMapPos39);
            this.Controls.Add(this.bMapPos40);
            this.Controls.Add(this.bMapPos41);
            this.Controls.Add(this.bMapPos42);
            this.Controls.Add(this.bMapPos29);
            this.Controls.Add(this.bMapPos30);
            this.Controls.Add(this.bMapPos31);
            this.Controls.Add(this.bMapPos32);
            this.Controls.Add(this.bMapPos33);
            this.Controls.Add(this.bMapPos34);
            this.Controls.Add(this.bMapPos35);
            this.Controls.Add(this.bMapPos22);
            this.Controls.Add(this.bMapPos23);
            this.Controls.Add(this.bMapPos24);
            this.Controls.Add(this.bMapPos25);
            this.Controls.Add(this.bMapPos26);
            this.Controls.Add(this.bMapPos27);
            this.Controls.Add(this.bMapPos28);
            this.Controls.Add(this.bMapPos15);
            this.Controls.Add(this.bMapPos16);
            this.Controls.Add(this.bMapPos17);
            this.Controls.Add(this.bMapPos18);
            this.Controls.Add(this.bMapPos19);
            this.Controls.Add(this.bMapPos20);
            this.Controls.Add(this.bMapPos21);
            this.Controls.Add(this.bMapPos9);
            this.Controls.Add(this.bMapPos10);
            this.Controls.Add(this.bMapPos11);
            this.Controls.Add(this.bMapPos12);
            this.Controls.Add(this.bMapPos13);
            this.Controls.Add(this.bMapPos14);
            this.Controls.Add(this.bMapPos5);
            this.Controls.Add(this.bMapPos6);
            this.Controls.Add(this.bMapPos7);
            this.Controls.Add(this.bMapPos8);
            this.Controls.Add(this.bMapPos3);
            this.Controls.Add(this.bMapPos4);
            this.Controls.Add(this.bMapPos2);
            this.Controls.Add(this.bMapPos1);
            this.Name = "MapForm";
            this.Text = "Move the box solver";
            this.Load += new System.EventHandler(this.MapForm_Load);
            this.ResumeLayout(false);

        }

        #endregion

        private void InitializeCustomControls()
        {
            bMapPos1.Coordinates = new Coordinates(0, 0);
            bMapPos2.Coordinates = new Coordinates(1, 0);
            bMapPos3.Coordinates = new Coordinates(2, 0);
            bMapPos4.Coordinates = new Coordinates(3, 0);
            bMapPos5.Coordinates = new Coordinates(4, 0);
            bMapPos6.Coordinates = new Coordinates(5, 0);
            bMapPos7.Coordinates = new Coordinates(6, 0);
            bMapPos8.Coordinates = new Coordinates(0, 1);
            bMapPos9.Coordinates = new Coordinates(1, 1);
            bMapPos10.Coordinates = new Coordinates(2, 1);
            bMapPos11.Coordinates = new Coordinates(3, 1);
            bMapPos12.Coordinates = new Coordinates(4, 1);
            bMapPos13.Coordinates = new Coordinates(5, 1);
            bMapPos14.Coordinates = new Coordinates(6, 1);
            bMapPos15.Coordinates = new Coordinates(0, 2);
            bMapPos16.Coordinates = new Coordinates(1, 2);
            bMapPos17.Coordinates = new Coordinates(2, 2);
            bMapPos18.Coordinates = new Coordinates(3, 2);
            bMapPos19.Coordinates = new Coordinates(4, 2);
            bMapPos20.Coordinates = new Coordinates(5, 2);
            bMapPos21.Coordinates = new Coordinates(6, 2);
            bMapPos22.Coordinates = new Coordinates(0, 3);
            bMapPos23.Coordinates = new Coordinates(1, 3);
            bMapPos24.Coordinates = new Coordinates(2, 3);
            bMapPos25.Coordinates = new Coordinates(3, 3);
            bMapPos26.Coordinates = new Coordinates(4, 3);
            bMapPos27.Coordinates = new Coordinates(5, 3);
            bMapPos28.Coordinates = new Coordinates(6, 3);
            bMapPos29.Coordinates = new Coordinates(0, 4);
            bMapPos30.Coordinates = new Coordinates(1, 4);
            bMapPos31.Coordinates = new Coordinates(2, 4);
            bMapPos32.Coordinates = new Coordinates(3, 4);
            bMapPos33.Coordinates = new Coordinates(4, 4);
            bMapPos34.Coordinates = new Coordinates(5, 4);
            bMapPos35.Coordinates = new Coordinates(6, 4);
            bMapPos36.Coordinates = new Coordinates(0, 5);
            bMapPos37.Coordinates = new Coordinates(1, 5);
            bMapPos38.Coordinates = new Coordinates(2, 5);
            bMapPos39.Coordinates = new Coordinates(3, 5);
            bMapPos40.Coordinates = new Coordinates(4, 5);
            bMapPos41.Coordinates = new Coordinates(5, 5);
            bMapPos42.Coordinates = new Coordinates(6, 5);
            bMapPos43.Coordinates = new Coordinates(0, 6);
            bMapPos44.Coordinates = new Coordinates(1, 6);
            bMapPos45.Coordinates = new Coordinates(2, 6);
            bMapPos46.Coordinates = new Coordinates(3, 6);
            bMapPos47.Coordinates = new Coordinates(4, 6);
            bMapPos48.Coordinates = new Coordinates(5, 6);
            bMapPos49.Coordinates = new Coordinates(6, 6);
            bMapPos50.Coordinates = new Coordinates(0, 7);
            bMapPos51.Coordinates = new Coordinates(1, 7);
            bMapPos52.Coordinates = new Coordinates(2, 7);
            bMapPos53.Coordinates = new Coordinates(3, 7);
            bMapPos54.Coordinates = new Coordinates(4, 7);
            bMapPos55.Coordinates = new Coordinates(5, 7);
            bMapPos56.Coordinates = new Coordinates(6, 7);
        }

        private MapPositionButton bMapPos1;
        private MapPositionButton bMapPos2;
        private MapPositionButton bMapPos3;
        private MapPositionButton bMapPos4;
        private MapPositionButton bMapPos5;
        private MapPositionButton bMapPos6;
        private MapPositionButton bMapPos7;
        private MapPositionButton bMapPos8;
        private MapPositionButton bMapPos9;
        private MapPositionButton bMapPos10;
        private MapPositionButton bMapPos11;
        private MapPositionButton bMapPos12;
        private MapPositionButton bMapPos13;
        private MapPositionButton bMapPos14;
        private MapPositionButton bMapPos15;
        private MapPositionButton bMapPos16;
        private MapPositionButton bMapPos17;
        private MapPositionButton bMapPos18;
        private MapPositionButton bMapPos19;
        private MapPositionButton bMapPos20;
        private MapPositionButton bMapPos21;
        private MapPositionButton bMapPos22;
        private MapPositionButton bMapPos23;
        private MapPositionButton bMapPos24;
        private MapPositionButton bMapPos25;
        private MapPositionButton bMapPos26;
        private MapPositionButton bMapPos27;
        private MapPositionButton bMapPos28;
        private MapPositionButton bMapPos29;
        private MapPositionButton bMapPos30;
        private MapPositionButton bMapPos31;
        private MapPositionButton bMapPos32;
        private MapPositionButton bMapPos33;
        private MapPositionButton bMapPos34;
        private MapPositionButton bMapPos35;
        private MapPositionButton bMapPos36;
        private MapPositionButton bMapPos37;
        private MapPositionButton bMapPos38;
        private MapPositionButton bMapPos39;
        private MapPositionButton bMapPos40;
        private MapPositionButton bMapPos41;
        private MapPositionButton bMapPos42;
        private MapPositionButton bMapPos43;
        private MapPositionButton bMapPos44;
        private MapPositionButton bMapPos45;
        private MapPositionButton bMapPos46;
        private MapPositionButton bMapPos47;
        private MapPositionButton bMapPos48;
        private MapPositionButton bMapPos49;
        private MapPositionButton bMapPos50;
        private MapPositionButton bMapPos51;
        private MapPositionButton bMapPos52;
        private MapPositionButton bMapPos53;
        private MapPositionButton bMapPos54;
        private MapPositionButton bMapPos55;
        private MapPositionButton bMapPos56;

        private ColorSelectorButton bCat1;
        private ColorSelectorButton bCat2;
        private ColorSelectorButton bCat3;
        private ColorSelectorButton bCat4;
        private ColorSelectorButton bCat5;
        private ColorSelectorButton bCat6;
        private ColorSelectorButton bCat0;
        private System.Windows.Forms.Button bQuit;
    }
}
Posted

I have just one but big idea: your badly overuse (abuse) the designer. If you get rid of it, it will solve all your problems with this code.

It gives you a lot of manual unsupportable tedious work. (Do you understand that "manual" programming in code means high reuse and intellectual effective processing; and "mouse programming" with the designer means killing reuse and make you a hostage of repetitive brainless work? Designer is not for "real" developers but mostly for lamers. However, basic design (main many, status bar, hierarchy of panels) is the real work for the designer.)

So, do the following: remove all similar repeated members from the designer, everything like category*, bMapPos* and the like. The rule of thumb is: if a member needs to have a numeral in its name, it does not have a right to exist. Also, such naming violates (good) Microsoft naming conventions. The auto-generated names simply cannot meet those conventions.

Now, remove them all and replace with the declaration in code. It should be arrays or some other collections. It will allow you to work with those object in loops.

And finally and very importantly: get rid of all event handlers generated by the designer. This is evil, especially in your case. Create all such handler only in code, using the following syntax:
C#
someObject.Click += (sender, eventArgs) => {
    // do something in response to the event
    // call any function;
    // using eventArgs or not:
    DoSomething(eventArgs)
    DoSomethingElse();
    // using sender or not:
    DoSomethingElse();
    DoSomethingElse(sender, eventArgs);
    DoSomethingElse(eventArgs);
    DoSomethingElse(sender);
    // ...
}; //someObject.Click


Equivalent anonymous syntax for C# v.2, when lambda was not yet introduces:
C#
<pre lang="c#">someObject.Click += delegate(System.Object sender, System.EventArgs eventArgs) => { /* ... */ };


Can you see the extra flexibility? Your "real" handler can have a different signature, using only the arguments which are really required.

I tell you, this will solve all your problems with code design. I don't see other problems at the moment.

—SA
 
Share this answer
 
Comments
[no name] 15-May-13 10:05am    
I will try to apply your suggestions and post my impressions. I hope that I 'll get along with your approach.

Issue 3 still annoys me. I am not sure if I clarified correctly.

Thanks a lot for your time checking that lengthy / boring / repetitive code.
Sergey Alexandrovich Kryukov 15-May-13 10:52am    
I addressed main thing so far.

Item #3 is less clear to me and less important. It may need separate consideration. But look: if you simply leave the constructor as is, it's good enough, as you apparently can use it only once, and you have to use it. You just do all constructions in one point. The further access to the number should be via a read-only property. This will provide sufficient fool-proof protection. If I miss something, we can discuss it, but you should provide more detail then.

I hope you won't forget to accept this answer formally (green button).
In all cases, your follow-up questions are welcome.

—SA
[no name] 15-May-13 14:16pm    
Of course I will. I want to try it first and then respond. I agree that #3 is minor compared to the rest that make the code crappy.
Sergey Alexandrovich Kryukov 15-May-13 14:44pm    
Your understanding of the problems is one of the most important keys to success. I respect your desire for clean supportable solutions.
—SA
Many thanks to Sergey Alexandrovich for the ideas that helped me improve/refactor the crappy code.

The main aspect is "not to use the designer" or "not to abuse the designer". I have manually created arrays of controls instead of using the designer and put them into containers. I also added 2 classes to further split and organize the code.

Here is the new designer form which now is handy:

C#
using BoardGame.Classes;
using BoardGame.Controls;

namespace BoardGame.Forms
{
    partial class MapForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }


        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.solveButton = new System.Windows.Forms.Button();
            this.quitButton = new System.Windows.Forms.Button();
            this.colorSelectorPanel = new System.Windows.Forms.Panel();
            this.gameMapPanel = new System.Windows.Forms.Panel();
            this.SuspendLayout();
            // 
            // solveButton
            // 
            this.solveButton.Location = new System.Drawing.Point(165, 424);
            this.solveButton.Name = "solveButton";
            this.solveButton.Size = new System.Drawing.Size(149, 34);
            this.solveButton.TabIndex = 63;
            this.solveButton.Text = "Solve";
            this.solveButton.UseVisualStyleBackColor = true;
            this.solveButton.Click += new System.EventHandler(this.solveButton_Click);
            // 
            // quitButton
            // 
            this.quitButton.Location = new System.Drawing.Point(51, 424);
            this.quitButton.Name = "quitButton";
            this.quitButton.Size = new System.Drawing.Size(74, 34);
            this.quitButton.TabIndex = 64;
            this.quitButton.Text = "Quit";
            this.quitButton.UseVisualStyleBackColor = true;
            this.quitButton.Click += new System.EventHandler(this.quitButton_Click);
            // 
            // colorSelectorPanel
            // 
            this.colorSelectorPanel.Location = new System.Drawing.Point(51, 362);
            this.colorSelectorPanel.Name = "colorSelectorPanel";
            this.colorSelectorPanel.Size = new System.Drawing.Size(263, 36);
            this.colorSelectorPanel.TabIndex = 65;
            // 
            // gameMapPanel
            // 
            this.gameMapPanel.Location = new System.Drawing.Point(51, 42);
            this.gameMapPanel.Name = "gameMapPanel";
            this.gameMapPanel.Size = new System.Drawing.Size(263, 314);
            this.gameMapPanel.TabIndex = 66;
            // 
            // MapForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(365, 488);
            this.Controls.Add(this.gameMapPanel);
            this.Controls.Add(this.colorSelectorPanel);
            this.Controls.Add(this.quitButton);
            this.Controls.Add(this.solveButton);
            this.Name = "MapForm";
            this.Text = "Move the box solver";
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Button solveButton;
        private System.Windows.Forms.Button quitButton;
        private System.Windows.Forms.Panel colorSelectorPanel;
        private System.Windows.Forms.Panel gameMapPanel;
    }
}



This is the new form class

C#
using BoardGame.Classes;
using BoardGame.Controls;
using System;
using System.Linq;
using System.Windows.Forms;

namespace BoardGame.Forms
{
    public partial class MapForm : Form
    {
        private Category _activeCategory = new Category(Config.CATEGORY_EMPTY);
        public Category ActiveCategory
        {
            get
            {
                return _activeCategory;
            }
            set
            {
                _activeCategory = value;
                activateCategorySelector();
            }
        }

        public MapForm()
        {
            InitializeComponent();
            createColorSelectorButtons();
            createMapPositionButtons();
        }

        private ColorSelectorButton[] colorSelectorButtonsArray;

        private void createColorSelectorButtons()
        {
            // Initial location points
            const int colorSelectorButtonStartingX = 0;
            const int colorSelectorButtonConstY = 0;

            // Creates the color selector usher
            const int horizontalGapSize = 2;
            int colorsCount = Config.CATEGORY_COLORS.Length;
            int totalHorizontalSpace = colorSelectorPanel.Size.Width;

            EntityUsher colorSelectorUsher = new EntityUsher(horizontalGapSize, 
                colorsCount, 
                totalHorizontalSpace,
                colorSelectorButtonStartingX,
                colorSelectorButtonConstY,
                Enums.Arrangement.horizontal);

            // Initializes array
            colorSelectorButtonsArray = new ColorSelectorButton[colorsCount];

            // Define a color selector button
            ColorSelectorButton colorSelectorButton;
            
            for (Byte colorIndex = 0; colorIndex < colorsCount; colorIndex++)
            {
                // Create a new
                colorSelectorButton = new ColorSelectorButton();

                // Name
                colorSelectorButton.Name = "colorSelectorButton_" + colorIndex;
                
                // Size
                colorSelectorButton.Size = colorSelectorUsher.getEntitySize();

                // Location
                colorSelectorButton.Location = colorSelectorUsher.getPoint(colorIndex);

                // Appearence
                colorSelectorButton.BackColor = Config.CATEGORY_COLORS[colorIndex];
                colorSelectorButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                colorSelectorButton.UseVisualStyleBackColor = true;

                // Text for the empty category
                if (colorIndex == 0)
                {
                    colorSelectorButton.Text = "X";
                }

                // Custom property - Category
                colorSelectorButton.CategoryNumber = colorIndex;

                // Collection participant
                colorSelectorButtonsArray[colorIndex] = colorSelectorButton;

                // Container participant
                colorSelectorPanel.Controls.Add(colorSelectorButton);

                // Events - click
                colorSelectorButton.Click += (sender, eventArgs) =>
                {
                    var colorSelectorButtonSender = sender as ColorSelectorButton;
                    this.ActiveCategory = new Category(colorSelectorButtonSender.CategoryNumber);
                };
            }
        }

        private MapPositionButton[,] mapPositionButtonsArray;

        private void createMapPositionButtons()
        {
            // Just shortcuts
            Byte mapSizeX = Config.MAP_SIZE_X;
            Byte mapSizeY = Config.MAP_SIZE_Y;

            // Initial location points
            int mapPositionButtonStartX = 0;
            int mapPositionButtonStartY = 0;

            // Creates the map position usher
            int mapGapSize = 2;
            int panelTotalHorizontalSpace = gameMapPanel.Size.Width;
            EntityUsher mapPositionsUsher = new EntityUsher(mapGapSize, mapSizeX, 
                panelTotalHorizontalSpace, 
                mapPositionButtonStartX, 
                mapPositionButtonStartY, 
                Enums.Arrangement.horizontal);
            
            // Initialize array
            mapPositionButtonsArray = new MapPositionButton[mapSizeX, mapSizeY];

            // Define
            MapPositionButton mapPositionButton;

            for (Byte y = 0; y < mapSizeY; y++)
            {
                for (Byte x = 0; x < mapSizeX; x++)
                {
                    // Create a new
                    mapPositionButton = new MapPositionButton();

                    // Name
                    mapPositionButton.Name = "mapPositionButton_" + x + "_" + y;

                    // Size
                    mapPositionButton.Size = mapPositionsUsher.getEntitySize();

                    // Location
                    mapPositionButton.Location = mapPositionsUsher.getPoint(x, y);

                    // Appearence
                    mapPositionButton.BackColor = System.Drawing.Color.Gainsboro;
                    mapPositionButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                    mapPositionButton.UseVisualStyleBackColor = true;

                    // Custom property - Category
                    mapPositionButton.Category = new Category(Config.CATEGORY_EMPTY);

                    // Custom property - Coordinates
                    mapPositionButton.Coordinates = new Coordinates(x, y);

                    // Collection participant
                    mapPositionButtonsArray[x, y] = mapPositionButton;

                    // Container participant
                    gameMapPanel.Controls.Add(mapPositionButton);

                    // Events - click
                    mapPositionButton.Click += (sender, eventArgs) =>
                    {
                        var mapPositionButtonSender = sender as MapPositionButton;
                        mapPositionButtonSender.Category = new Category(this._activeCategory.Number);
                    };
                }
            }
        }

        private void activateCategorySelector() 
        {
            foreach (var colorSelectorButton in this.colorSelectorPanel.Controls.OfType<colorselectorbutton>())
            {
                if (Byte.Equals(colorSelectorButton.CategoryNumber, _activeCategory.Number))
                {
                    colorSelectorButton.activate();
                }
                else
                {
                    colorSelectorButton.deactivate();
                }
            }
        }

        private void solveButton_Click(object sender, EventArgs e)
        {
            GameMap gameMap = new GameMap();

            // Sends the information of the map from the gui to the object
            foreach (var mapPositionButton in this.Controls.OfType<mappositionbutton>())
            {
                //gameMap.setCategory(b.Coordinates);
            }
        }

        private void quitButton_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}
</mappositionbutton></colorselectorbutton>





This is a new class that helps me arrange the control arrays to the correct positions into their containers.

C#
using System;
using System.Drawing;

namespace BoardGame.Classes
{
    public class EntityUsher
    {
        private int _gapSize;
        private int _entitiesCount;
        private int _totalSpace;
        private int _startingX;
        private int _startingY;
        private Enums.Arrangement _arangement;

        public EntityUsher(int gapSize, int entitiesCount, int totalSpace, int startingX, int startingY, Enums.Arrangement arangement)
        {
            _gapSize = gapSize;
            _entitiesCount = entitiesCount;
            _totalSpace = totalSpace;
            _startingX = startingX;
            _startingY = startingY;
            _arangement = arangement;
        }

        private int getEntitySizeInt()
        {
            int gapsCount = _entitiesCount - 1;
            int availableSpace = _totalSpace - (gapsCount * _gapSize);
            int entitySize = availableSpace / _entitiesCount;
            
            return entitySize;
        }

        private int getLocation(Byte entityPosition)
        {
            Byte gapsCount = entityPosition;

            int spaceForGaps = gapsCount * _gapSize;
            int spaceForEntities = entityPosition * getEntitySizeInt();

            return spaceForEntities + spaceForGaps;
        }

        public System.Drawing.Size getEntitySize()
        { 
            int size = getEntitySizeInt();
            return new System.Drawing.Size(size, size);
        }

        public Point getPoint(Byte entityPosition)
        {
            if (_arangement == Enums.Arrangement.horizontal)
            {
                return getPoint(entityPosition, 0);
            }
            else if (_arangement == Enums.Arrangement.vertical)
            {
                return getPoint(0, entityPosition);
            }

            // This is not a valid case.
            return getPoint(0, 0);
        }

        public Point getPoint(Byte entityPositionX, Byte entityPositionY)
        {
            int x = _startingX + getLocation(entityPositionX);
            int y = _startingY + getLocation(entityPositionY);

            return new Point(x, y);
        }
    }
}




and a small class Enums to make public an enum I use in two places

C#
namespace BoardGame.Classes
{
    public class Enums
    {
        public enum Arrangement { horizontal, vertical };
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900