private void FirestAni_MouseEnter(object sender, MouseEventArgs e)
        {
            Thread t1 = new Thread(new ParameterizedThreadStart(Animation));
            t1.Start();
        }
void Animation()
        {
            while (true)
            {
                DoubleAnimation widthAnimation = new DoubleAnimation();
                widthAnimation.From = FirestAni.ActualWidth;
                widthAnimation.To = this.Width - 30;
                widthAnimation.AutoReverse = true;
                widthAnimation.Completed += animation_Completed;
                FirestAni.BeginAnimation(Button.WidthProperty, widthAnimation);
            }
        }报的错误是:No overload for 'Animation' matches delegate 'System.Threading.ParameterizedThreadStart'

解决方案 »

  1.   


    private void FirestAni_MouseEnter(object sender, MouseEventArgs e) 

                Thread t1 = new Thread(Animation); //这里试试
                t1.Start(); 
    } void Animation() 
            { 
                while (true) 
                { 
                    DoubleAnimation widthAnimation = new DoubleAnimation(); 
                    widthAnimation.From = FirestAni.ActualWidth; 
                    widthAnimation.To = this.Width - 30; 
                    widthAnimation.AutoReverse = true; 
                    widthAnimation.Completed += animation_Completed; 
                    FirestAni.BeginAnimation(Button.WidthProperty, widthAnimation); 
                } 
            } 
      

  2.   

       Thread t1 = new Thread(new ParameterizedThreadStart(Animation)); 改成Thread t1 = new Thread(new ThreadStart(Animation));