close
99格
用for迴圈產生9x9格
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
System.Windows.Forms.Button button1;
System.Windows.Forms.Button[] buttons;
Button[,] button = new Button[9, 9];
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 9; i++)
{
for (int j = 0; j < 9; j++)
{
button[i, j] = new Button();
button[i, j].Location = new Point(i * 50, j * 50);
this.Controls.Add(button[i, j]);
}
}
}
private void Button1_Click(object sender, EventArgs e)
{
MessageBox.Show("YA");
}
}
}
excel
全站熱搜
留言列表