搜尋此網誌

2010年10月15日 星期五

4x4矩陣

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
    {
        System.Windows.Forms.TextBox[] textboxs;
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            textboxs = new System.Windows.Forms.TextBox[16];
            for (int i = 0; i < 16; ++i)
            {
                textboxs[i] = new TextBox();
                this.Controls.Add(textboxs[i]);
                if (i <= 3)
                    textboxs[i].Location = new System.Drawing.Point(10 + i * 80, 10);
                else if (i > 3 && i <= 7)
                    textboxs[i].Location = new System.Drawing.Point(10 + (i - 4) * 80, 40);
                else if (i > 7 && i <= 11)
                    textboxs[i].Location = new System.Drawing.Point(10 + (i - 8) * 80, 70);
                else if (i > 11 && i <= 16)
                    textboxs[i].Location = new System.Drawing.Point(10 + (i - 12) * 80, 100);
            }
            textboxs = new System.Windows.Forms.TextBox[16];
            for (int j = 0; j < 16; ++j)
            {
                textboxs[j] = new TextBox();
                this.Controls.Add(textboxs[j]);
                if (j <= 3)
                    textboxs[j].Location = new System.Drawing.Point(10 + j * 80, 10 + 150);
                else if (j > 3 && j <= 7)
                    textboxs[j].Location = new System.Drawing.Point(10 + (j - 4) * 80, 40 + 150);
                else if (j > 7 && j <= 11)
                    textboxs[j].Location = new System.Drawing.Point(10 + (j - 8) * 80, 70 + 150);
                else if (j > 11 && j <= 15)
                    textboxs[j].Location = new System.Drawing.Point(10 + (j - 12) * 80, 100 + 150);
            }
            textboxs = new System.Windows.Forms.TextBox[16];
            for (int k = 0; k < 16; ++k)
            {
                textboxs[k] = new TextBox();
                this.Controls.Add(textboxs[k]);
                if (k <= 3)
                    textboxs[k].Location = new System.Drawing.Point(10 + k * 80, 10 + 300);
                else if (k > 3 && k <= 7)
                    textboxs[k].Location = new System.Drawing.Point(10 + (k - 4) * 80, 40 + 300);
                else if (k > 7 && k <= 11)
                    textboxs[k].Location = new System.Drawing.Point(10 + (k - 8) * 80, 70 + 300);
                else if (k > 11 && k <= 16)
                    textboxs[k].Location = new System.Drawing.Point(10 + (k - 12) * 80, 100 + 300);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
           textboxs[
        }
    }
}

沒有留言:

張貼留言