Ejemplo n.º 1
0
        private void ResetGrid_Click(object sender, EventArgs e)
        {
            List <BitToggler> bts = GetBitTogglers();

            foreach (BitToggler bt in bts)
            {
                bt.BackColor = Color.White;
                bt.isToggled = false;
            }
            Panel_GridOptions.Hide();
        }
Ejemplo n.º 2
0
 private void Button_GridOptions_Click(object sender, EventArgs e)
 {
     if (Panel_GridOptions.Visible)
     {
         Panel_GridOptions.Hide();
     }
     else
     {
         Panel_GridOptions.Show();
     }
 }
Ejemplo n.º 3
0
        private void GenerateGrid_Click(object sender, EventArgs e)
        {
            Panel_Editor.Hide();
            Panel_GridOptions.Hide();
            Icon_Loading.Show();
            Panel_Editor.Controls.Clear();

            for (int x = 0; x < UpDown_GridX.Value; x++)
            {
                for (int y = 0; y < UpDown_GridY.Value; y++)
                {
                    var newToggler = new BitToggler
                    {
                        row    = y,
                        column = x
                    };

                    int xmod = (int)UpDown_GridX.Value / 8;
                    int ymod = (int)UpDown_GridY.Value / 8;

                    if (xmod > ymod)
                    {
                        newToggler.Location = new Point((x * (newToggler.Size.Width + 1) / xmod) + x,
                                                        (y * (newToggler.Size.Width + 1) / xmod) + y);

                        newToggler.Size = new Size(newToggler.Size.Width / xmod,
                                                   newToggler.Size.Width / xmod);
                    }
                    else
                    {
                        newToggler.Location = new Point((x * (newToggler.Size.Width + 1) / ymod) + x,
                                                        (y * (newToggler.Size.Width + 1) / ymod) + y);

                        newToggler.Size = new Size(newToggler.Size.Width / ymod,
                                                   newToggler.Size.Width / ymod);
                    }

                    Panel_Editor.Controls.Add(newToggler);
                    Icon_Loading.Invalidate();
                    Icon_Loading.Update();
                }
            }

            Icon_Loading.Hide();
            Panel_Editor.Show();

            columns = (int)UpDown_GridX.Value;
            rows    = (int)UpDown_GridY.Value;
        }
Ejemplo n.º 4
0
        private void InvertGrid_Click(object sender, EventArgs e)
        {
            List <BitToggler> bts = GetBitTogglers();

            foreach (BitToggler bt in bts)
            {
                if (bt.BackColor == Color.White)
                {
                    bt.BackColor = Color.Black;
                }
                else
                {
                    bt.BackColor = Color.White;
                }

                bt.isToggled = !bt.isToggled;
            }
            Panel_GridOptions.Hide();
        }
Ejemplo n.º 5
0
        private void Window_Load(object sender, EventArgs e)
        {
            Panel_GridOptions.Hide();
            Icon_Loading.Hide();

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    var newToggler = new BitToggler
                    {
                        row    = y,
                        column = x
                    };
                    newToggler.Location = new Point(x * 43, y * 43);
                    Panel_Editor.Controls.Add(newToggler);
                }
            }
            rows    = 8;
            columns = 8;
        }