Spirit.Source = cutImage(@"Player\PlayerMagic.png", count * 150, 0, 150, 150);
为什么这一行的数字改一下就不行namespace WpfApplication2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        Image Spirit;        int count = 1;
        public MainWindow()
        {
            InitializeComponent();
            Spirit = new Image();            Spirit.Width = 150;            Spirit.Height = 150;            Carrier.Children.Add(Spirit);            DispatcherTimer dispatcherTimer = new DispatcherTimer();            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);            dispatcherTimer.Interval = TimeSpan.FromMilliseconds(150);            dispatcherTimer.Start();
        }
        private void dispatcherTimer_Tick(object sender, EventArgs e) {            Spirit.Source = cutImage(@"Player\PlayerMagic.png", count * 150, 0, 150, 150);            count = count == 9 ? 0 : count + 1;        }         /// <summary>        /// 截取图片        /// </summary>        /// <param name="imgaddress">文件名(包括地址+扩展名)</param>        /// <param name="x">左上角点X</param>        /// <param name="y">左上角点Y</param>        /// <param name="width">截取的图片宽</param>        /// <param name="height">截取的图片高</param>        /// <returns>截取后图片数据源</returns>        private BitmapSource cutImage(string imgaddress, int x, int y, int width, int height)
        {            return new CroppedBitmap(                BitmapFrame.Create(new Uri(imgaddress, UriKind.Relative)),                new Int32Rect(x, y, width, height)                 );
        }    }
}