close

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;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int width, height;
int i, j,x;
Button[,] Buttons = new Button[10, 10];
int[] k = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
for (i = 1; i < 5; i++)
{
for (j = 1; j < 5; j++)
{
Buttons[i, j] = new Button();
this.Controls.Add(Buttons[i, j]);
Buttons[i, j].Location = new Point(i * 60,j* 60);
width = this.Size.Width;
height = this.Size.Height;
width /= 11;
height /= 6;
Buttons[i, j].Size = new Size(width, height);
x=k[(i-1)*4+j-1];
Buttons[i, j].Text = x.ToString();
}
}
}
}
}

arrow
arrow
    全站熱搜

    smilebean778899 發表在 痞客邦 留言(0) 人氣()