public void setMass() { int x, y; int k = 0; bool b = false; for (int i = 0; (i < n) && (k < ButImage.nn); i++) { for (int j = 0; (j < m) && (k < ButImage.nn); j++) { if (massButt[i, j] == null) { b = false; massButt[i, j] = new ButImage(); massButt[i, j].setIndexImag(k, path); while (b == false) { x = rand.Next(0, n); y = rand.Next(0, m); if (massButt[x, y] == null) { massButt[x, y] = new ButImage(); massButt[x, y].setIndexImag(k, path); b = true; k++; } } } } } }
public void initButton() { ButImage.nn = n * m / 2; massButt = new ButImage[n, m]; setMass(); mButt = new Button[n, m]; setButt(); }