2014年11月28日 星期五

我忘了...

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 WindowsFormsApplication13
{
    public partial class Form1 : Form
    {

        Button[,] Buttons =new Button[5,5];//5*5格子
     
        Random irand = new Random(Guid.NewGuid().GetHashCode());
     





        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
           // APPLE();

            int a = 70;
            int b = 60;

            int r;
            for (int i = 1; i < 5; i++)
            {
                for (int j = 1; j < 5; j++)
                {
                    Random irand = new Random(Guid.NewGuid().GetHashCode());
                    Buttons[i, j] = new Button();
                    Buttons[i, j].Location = new Point(i * 60, j * 70 + 10);//算格子堅格寬度
                    this.Controls.Add(Buttons[i, j]);
                    Buttons[i, j].Size = new System.Drawing.Size(a, b);
                    r = irand.Next(0, 15);
                    Buttons[i, j].Text = r.ToString();//轉,顯示



//以下是其他的東西有興趣可以用來玩玩

                    // Button1 = new System.Windows.Forms.Button();
                    // Button1.Location = new Point(100, 100);
                    //Button1.Size = new System.Drawing.Size(200, 200);
                    //Button1.Click += new EventHandler(Button1_Click);
                    //Button1.BackColor = Color.Green;
                    // this.Controls.Add(Button1);

                }
            }
        }
//        private void APPLE()
  //      {
    //        int r;
     
         // Button1 = new System.Windows.Forms.Button();
           // Button1.Location = new Point(100, 100);
          //  Button1.Size = new System.Drawing.Size(200, 200);
           // this.Controls.Add(Button1);
      //    int width, height;
         
        //    width = this.Size.Width;
          //  height = this.Size.Height;

            //Buttons = new System.Windows.Forms.Button[16];

         //   width= 100;
          //  height= 100;



        //    for (int i = 0; i < 16; ++i)
          //  {
             

            //    Random irand = new Random(Guid.NewGuid().GetHashCode());
             
              //  Buttons[i] = new Button();

                //this.Controls.Add(Buttons[i]);


             

                  //  Buttons[i].Location = new System.Drawing.Point(300 + i * 100, 100);
                //else if (i > 3 && i <= 7)
                 //   Buttons[i].Location = new System.Drawing.Point(200 + (i - 3) * 100, 200);
               // else if (i > 7 && i <= 11)
                //    Buttons[i].Location = new System.Drawing.Point(100 + (i - 6) * 100, 300);
               // else if (i > 11 && i <= 16)
                 //   Buttons[i].Location = new System.Drawing.Point(0 + (i - 9) * 100, 400);

                //Buttons[i].Text = irand.ToString();
               //r=irand.Next(0,15);
               // Buttons[i].Size = new Size(width, height);
               // Buttons[i].Size = new System.Drawing.Size(100, 100);
              //  Buttons[i].BackColor = Color.Green;
               // Buttons[i].Click += new EventHandler(Buttons_Click);

            }
        }


//private void Buttons_Click(object sender, EventArgs e)
  //      {

    //                 Button btn = (Button)sender;
      //      MessageBox.Show(btn.Text);
        //    for (int i = 0; i < 16; ++i)
          //  {
            //    Buttons[i] = new Button();
                       
              //  this.Controls.Add(Buttons[i]);              
             
            //}
        //}
    //}
//}

2014年11月24日 星期一

聊天室建置配方-1

<html>
<head>
<meta http-equiv="refresh"content="1" />
</head>


<body>
<font color="red"今天日期:><?php date_default_timezone_set("Hongkong");
echo date("Y-m-d");?></font>
<br>
<font color="blue">現在時間:<?php echo date("h-i-s");?>
</body>
</html>

2014年11月20日 星期四

計算機


網址連結   程式設計工藝大師 http://tccnchsu.blogspot.tw/



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 _1
{
public partial class Form1 : Form
{
int a = 0, b = 0,i=4;
float a1 = 0, b1 = 0, c1 = 1;
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
textBox2.Text ="+";
if (a == 0) {
a = 1;
textBox2.Visible = true;
textBox3.Visible = true;
b = 0;
button17.Enabled = true;
c1 = 1;
}
i = 0;
}

private void button2_Click(object sender, EventArgs e)
{
textBox2.Text ="-";
if (a == 0)
{
a = 1;
textBox2.Visible = true;
textBox3.Visible = true;
b = 0;
button17.Enabled = true;
c1 = 1;
}
i = 1;
}

private void button3_Click(object sender, EventArgs e)
{
textBox2.Text ="*";
if (a == 0)
{
a = 1;
textBox2.Visible = true;
textBox3.Visible = true;
b = 0;
button17.Enabled = true;
c1 = 1;
}
i = 2;
}

private void button4_Click(object sender, EventArgs e)
{
textBox2.Text ="/";
if (a == 0)
{
a = 1;
textBox2.Visible = true;
textBox3.Visible = true;
b = 0;
button17.Enabled = true;
c1 = 1;
}
i = 3;
}
private void button5_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
a = 0;
b = 0;
a1 = 0;
b1 = 0;
c1 = 1;
i = 4;
textBox2.Visible = false;
textBox3.Visible = false;
textBox4.Visible = false;
button17.Enabled = true;
}

private void button8_Click(object sender, EventArgs e)
{
add(1);
}

private void button9_Click(object sender, EventArgs e)
{
add(2);
}

private void button10_Click(object sender, EventArgs e)
{
add(3);
}

private void button11_Click(object sender, EventArgs e)
{
add(4);
}

private void button12_Click(object sender, EventArgs e)
{
add(5);
}

private void button13_Click(object sender, EventArgs e)
{
add(6);
}

private void button14_Click(object sender, EventArgs e)
{
add(7);
}

private void button15_Click(object sender, EventArgs e)
{
add(8);
}

private void button16_Click(object sender, EventArgs e)
{
add(9);
}

private void button17_Click(object sender, EventArgs e)
{
b = 1;
button17.Enabled = false;
if (a == 0) { textBox1.Text = textBox1.Text + "."; }
if (a == 1)
{
textBox3.Text = textBox3.Text + ".";
}
}

private void button7_Click(object sender, EventArgs e)
{
textBox4.Visible = true;
if (i == 0)
{
c1=a1+b1;
textBox4.Text = ""+c1;
}
if (i == 1)
{
c1 = a1 - b1;
textBox4.Text = "" + c1;
}
if (i == 2)
{
c1 = a1 * b1;
textBox4.Text = "" + c1;
}
if (i == 3)
{
if (b1 != 0)
{
c1 = a1 / b1;
textBox4.Text = "" + c1;
}
else if (b1 == 0) { textBox4.Text = "error!"; }
}
}

private void add(int i)
{
if (a == 0)
{
textBox1.Text = textBox1.Text +i;
if (b == 0)
{
a1 = a1 * 10 + i;
}
if (b == 1)
{
c1 = c1 / 10;
a1 = a1 + i * c1;
}
}
if (a == 1)
{
textBox3.Text = textBox3.Text+i ;
if (b == 0)
{
b1 = b1 * 10 + i;
}
if (b == 1)
{
c1 = c1 / 10;
b1 = b1 + i * c1;
}
}
}

private void button6_Click(object sender, EventArgs e)
{
add(0);
}
}
}

2014年11月14日 星期五

99成法表

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 WindowsFormsApplication8
{
    public partial class Form1 : Form
    {
        //System.Windows.Forms.Button[,] Buttons;
        Button[,] Buttons = new Button[10,10];


        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //int i;
            //int j;
            for (int i=1;i<10; i++)
            {
                for (int j = 1; j <10; j++)
                {

                    Buttons[i, j] = new Button();
                    Buttons[i, j].Location = new Point(i * 70 + 10, j * 65 + 10);
                    this.Controls.Add(Buttons[i, j]);

                    int a = 70;
                    int b = 65;
                    int k;
                    k = i * j;
                    Buttons[i, j].Size = new System.Drawing.Size(a, b);
                    string varString = i.ToString();
                    string varString2 = j.ToString();
                    string varString3 = k.ToString();

                    Buttons[i, j].Text = varString + "*" + varString2 + "=" + varString3;



                }
            }
           
        }
    }
}

2014年11月13日 星期四

excel99乘法表(就是要硬幹),for迴圈google大神找到的







Private Sub CommandButton1_Click()
Cells(1, 1) = 1
Cells(1, 2) = 2
Cells(1, 3) = 3
Cells(1, 4) = 4
Cells(1, 5) = 5
Cells(1, 6) = 6
Cells(1, 7) = 7
Cells(1, 8) = 8
Cells(1, 9) = 9

Cells(2, 1) = 1 * 2
Cells(2, 2) = 2 * 2
Cells(2, 3) = 3 * 2
Cells(2, 4) = 4 * 2
Cells(2, 5) = 5 * 2
Cells(2, 6) = 6 * 2
Cells(2, 7) = 2 * 7
Cells(2, 8) = 2 * 8
Cells(2, 9) = 2 * 9

Cells(1 * 3, 1) = 1 * 3
Cells(1 * 3, 2) = 2 * 3
Cells(1 * 3, 3) = 3 * 3
Cells(1 * 3, 4) = 4 * 3
Cells(1 * 3, 5) = 5 * 3
Cells(1 * 3, 6) = 6 * 3
Cells(1 * 3, 7) = 7 * 3
Cells(1 * 3, 8) = 8 * 3
Cells(1 * 3, 9) = 9 * 3

Cells(1 * 4, 1) = 1 * 4
Cells(1 * 4, 2) = 2 * 4
Cells(1 * 4, 3) = 3 * 4
Cells(1 * 4, 4) = 4 * 4
Cells(1 * 4, 5) = 5 * 4
Cells(1 * 4, 6) = 6 * 4
Cells(1 * 4, 7) = 7 * 4
Cells(1 * 4, 8) = 8 * 4
Cells(1 * 4, 9) = 9 * 4

Cells(1 * 5, 1) = 1 * 5
Cells(1 * 5, 2) = 2 * 5
Cells(1 * 5, 3) = 3 * 5
Cells(1 * 5, 4) = 4 * 5
Cells(1 * 5, 5) = 5 * 5
Cells(1 * 5, 6) = 6 * 5
Cells(1 * 5, 7) = 7 * 5
Cells(1 * 5, 8) = 8 * 5
Cells(1 * 5, 9) = 9 * 5

Cells(1 * 6, 1) = 1 * 6
Cells(1 * 6, 2) = 2 * 6
Cells(1 * 6, 3) = 3 * 6
Cells(1 * 6, 4) = 4 * 6
Cells(1 * 6, 5) = 5 * 6
Cells(1 * 6, 6) = 6 * 6
Cells(1 * 6, 7) = 7 * 6
Cells(1 * 6, 8) = 8 * 6
Cells(1 * 6, 9) = 9 * 6

Cells(1 * 7, 1) = 1 * 7
Cells(1 * 7, 2) = 2 * 7
Cells(1 * 7, 3) = 3 * 7
Cells(1 * 7, 4) = 4 * 7
Cells(1 * 7, 5) = 5 * 7
Cells(1 * 7, 6) = 6 * 7
Cells(1 * 7, 7) = 7 * 7
Cells(1 * 7, 8) = 8 * 7
Cells(1 * 7, 9) = 9 * 7

Cells(1 * 8, 1) = 1 * 8
Cells(1 * 8, 2) = 2 * 8
Cells(1 * 8, 3) = 3 * 8
Cells(1 * 8, 4) = 4 * 8
Cells(8 * 1, 5) = 5 * 8
Cells(1 * 8, 6) = 6 * 8
Cells(1 * 8, 7) = 7 * 8
Cells(1 * 8, 8) = 8 * 8
Cells(1 * 8, 9) = 9 * 8

Cells(1 * 9, 1) = 1 * 9
Cells(1 * 9, 2) = 2 * 9
Cells(1 * 9, 3) = 3 * 9
Cells(1 * 9, 4) = 4 * 9
Cells(1 * 9, 5) = 5 * 9
Cells(1 * 9, 6) = 6 * 9
Cells(1 * 9, 7) = 7 * 9
Cells(1 * 9, 8) = 8 * 9
Cells(1 * 9, 9) = 9 * 9
End Sub-----以上為硬幹



下圍攻勢





Private Sub CommandButton2_Click()


Application.ActiveSheet.Cells(1, 1).Value = "Excel VBA 99乘法表"
For C = 1 To 9
Application.Cells(1, C).ColumnWidth = 3
Next
For i = 1 To 9
For j = 1 To 9
Application.ActiveSheet.Cells(i + 1, j).Value = i * j
Next
Next
End Sub
這個太無恥了= =完全看不懂ㄏㄏ自己去找吧...想不出來建議硬幹
想的出來恭喜你~~

2014年11月7日 星期五

ooxx基礎

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 WindowsFormsApplication10
{
    public partial class Form1 : Form
    {
        System.Windows.Forms.Button[] Buttons;


       System.Windows.Forms.Button Button1;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
             APPLE();

     
               // Button1 = new System.Windows.Forms.Button();
               // Button1.Location = new Point(100, 100);
                //Button1.Size = new System.Drawing.Size(200, 200);
                //Button1.Click += new EventHandler(Button1_Click);
                //Button1.BackColor = Color.Green;
               // this.Controls.Add(Button1);
   

        }

     

   
        private void Button1_Click(object sender, EventArgs e)
        {
 Button btn = (Button)sender;
            MessageBox.Show(btn.Text);
   
         
        }
       
        private void APPLE()
        {
     
         // Button1 = new System.Windows.Forms.Button();
           // Button1.Location = new Point(100, 100);
          //  Button1.Size = new System.Drawing.Size(200, 200);
           // this.Controls.Add(Button1);
          int width, height;
            width = this.Size.Width;
            height = this.Size.Height;

            Buttons = new System.Windows.Forms.Button[9];

         //   width= 100;
          //  height= 100;



            for (int i = 0; i < 9; ++i)
            {
                Buttons[i] = new Button();

                this.Controls.Add(Buttons[i]);


                if (i <= 2)

                    Buttons[i].Location = new System.Drawing.Point(100 + i * 100, 100);


                else if (i > 2 && i <= 5)
                    Buttons[i].Location = new System.Drawing.Point(100 + (i - 3) * 100, 200);
                else if (i > 5 && i <= 9)
                    Buttons[i].Location = new System.Drawing.Point(100 + (i - 6) * 100, 300);
                Buttons[i].Text = i.ToString();
                Buttons[i].Size = new Size(width, height);
                Buttons[i].Size = new System.Drawing.Size(100, 100);
                Buttons[i].BackColor = Color.Green;
                Buttons[i].Click += new EventHandler(Button1_Click);
             
            }

     
     
     
     
        }


    }
}