2014年11月24日 星期一

2014/10/03 按按鈕左右跑


假設BUTTON為兩個車子
使其往左右邊界開       


 public partial class Form1 : Form
        {
            int c ;
            int b ;
            public Formal()
            {
                      InitializeComponent();
             }
              private void timer1_Click(object sender, EventArgs e)
          {
                  if (button1.Left > 345)
                        {
                             b = -1 ;
                        if button1.Left <= 0) 
                        {
                            b = 1 ;
                        }
                        c = c + b ;
              }
        }

沒有留言:

張貼留言