2014年11月24日 星期一

2014/11/14 九九乘法表 ( c# 和 excel )


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 WindowsFormsApplication2
{
public partial class Form1 : Form
{
Button[,] buttons = new Button[10, 10];
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
for (int i = 1; i < 10; i++)
{
for (int j = 1; j < 10; j++)
{
buttons[i, j] = new Button();
buttons[i, j].Size = new Size(51, 51);
buttons[i, j].Location = new Point(i * 45, j * 45);
buttons[i, j].Text = Convert.ToString(i * j);
this.Controls.Add(buttons[i, j]);
}
}
}
}
}

沒有留言:

張貼留言