using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Navigation;

using System.Windows.Shapes;

 

namespace DemoShakeWpf

{

    /// <summary>

    /// Interaction logic for Window1.xaml

    /// </summary>

    public partial class Window1 : Window

    {

        private const int rector = 5;

        public Window1()

        {

            InitializeComponent();

        }

 

        private void button1_Click(object sender, RoutedEventArgs e)

        {

            for (int x = 0; x < 4; x++)

            {

                for (int i = 0; i < 4; i++)

                {

                    if (i == 0)

                    {

                        this.Top = this.Top + rector;

                    }

                    if (i == 1)

                    {

                        this.Left = this.Left + rector;

                    }

                    if (i == 2)

                    {

                        this.Top = this.Top - rector;

                    }

                    if (i == 3)

                    {

                        this.Left = this.Left - rector;

                    }

                }

            }

        }

    }

}

 

arrow
arrow
    全站熱搜

    狼翔月影 發表在 痞客邦 留言(0) 人氣()