2015年11月5日 星期四

第一節課 (按鈕移動)

需要一個button

    public partial class Form1 : Form
    {
        int x, y, c = 0;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            c = c + 50;
            x = c;
            y = 50;
            button1.Location = new Point(x, y);
            button1.Text = x.ToString();
        }
    }
}

沒有留言:

張貼留言