using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Button[,] pole = new Button[8, 8];
int x = 50, y = 50;
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 6; j++)
{
Image rub = Image.FromFile("kruh.png");
pole[i, j] = new Button();
pole[i, j].Location = new Point(x, y);
pole[i, j].Name = "btn" + i.ToString() +j.ToString();
pole[i, j].Size = new Size(100, 100);
pole[i, j].Image = rub;
pole[i, j].Text = "btn" + i.ToString() + j.ToString();
Controls.Add(pole[i, j]);
x += 100;
}
x = 50; y += 100;
}
}
}
}
Pracuji na pexesu a v programu mám pole tlačítek, ale nevím jak udělat, se na ně dalo klikat. Děkuji za radu :)