Пример #1
0
        private void btnFill_Click(object sender, EventArgs e)
        {
            if (comboBoxCellTypes.SelectedIndex != -1)
            {
                int a = comboBoxCellTypes.SelectedIndex;
                if (a == 0)
                    current = zero;
                else if (a == 1)
                    current = one;
                else if (a == 2)
                    current = two;
                else if (a == 3)
                    current = three;
                else if (a == 4)
                    current = four;
                else if (a == 5)
                    current = five;
                else if (a == 6)
                    current = six;
                else
                    current = zero;
            }
            else
                current = zero;

            Graphics g = Graphics.FromImage(map);

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    mapData[x, y] = current.code;
                    g.DrawImage(current.bitmap, x*16, y*16, (float)16, (float)16);
                }
            }

            panelMap.Refresh();
        }
Пример #2
0
 private void btnSelectCellType_Click(object sender, EventArgs e)
 {
     if (comboBoxCellTypes.SelectedIndex != -1)
     {
         int a = comboBoxCellTypes.SelectedIndex;
         if (a == 0)
             current = zero;
         else if (a == 1)
             current = one;
         else if (a == 2)
             current = two;
         else if (a == 3)
             current = three;
         else if (a == 4)
             current = four;
         else if (a == 5)
             current = five;
         else if (a == 6)
             current = six;
     }
 }