11/7 產生方塊
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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
System.Windows.Forms.Butto
System.Windows.Forms.Butto
public Form1()
{
InitializeComponent();
}
int aa;
private void Form1_Load(object sender, EventArgs e)
{
//
//
//
/*測試單一按鈕*/
mybuttons( aa );
}
private void Button_Click(Object sender, EventArgs e)
{
Button number = (Button)sender;
MessageBox.Show(number.Tex
}
private void mybuttons(int i)
{
Buttons = new System.Windows.Forms.Butto
for ( i = 0; i < 9; i++)
{
Buttons[i] = new Button();
Buttons[i].Text = i.ToString();
Buttons[i].BackColor = Color.White;
this.Controls.Add(Buttons[
Buttons[i].Click += new System.EventHandler(Button
if (i <= 2)
{
Buttons[i].Location = new System.Drawing.Point(100 + i * 200, 50);
Buttons[i].Size = new Size(100, 100);
}
else if (i > 2 && i <= 5)
{
Buttons[i].Location = new System.Drawing.Point(100 + (i - 3) * 200, 200);
Buttons[i].Size = new Size(100, 100);
}
else if (i > 5 && i <= 9)
{
Buttons[i].Location = new System.Drawing.Point(100 + (i - 6) * 200, 350);
Buttons[i].Size = new Size(100, 100);
}
}
}
}
}
0 個意見:
張貼留言
訂閱 張貼留言 [Atom]
<< 首頁