当前位置:编程学习 > C#/ASP.NET >>

求助WPF

各位帮忙看一下,下面代码,当我点击向左移按钮时一直会出现程序错误。自动终止。多谢了。
            //初始化有关窗口最大化最小化的部分
            sp = new StackPanel();
            sp.Name = "spspsp";
            
            closeButton = new Button();
            closeButton.Content = "关闭";
            miniButton = new Button();
            miniButton.Content = "最小化";
            maxButton = new Button();
            maxButton.Content = "最大化";
            beginButton = new Button();
            beginButton.Content = "旋转";
            beginButton.Click += beginButton_Click;
            moveLeftButton = new Button();
            moveLeftButton.Content = "向左移";
            moveLeftButton.Click += moveLeftButton_Click;

            sp.Orientation = Orientation.Horizontal;
            sp.Children.Add(miniButton);
            sp.Children.Add(maxButton);
            sp.Children.Add(closeButton);
            sp.Children.Add(beginButton);
            sp.Children.Add(moveLeftButton);
            sp.Width = 300;
            sp.Height = 550;

            threeDContainer.Children.Add(sp);
            threeDContainer.Width = 300;
            threeDContainer.Height = 550;

            moveLeftAnimation = new DoubleAnimation();
            moveLeftAnimation.From = 180;
            moveLeftAnimation.To = 0;
            moveLeftAnimation.Duration =new Duration( TimeSpan.FromSeconds(3));
            moveLeftStoryBoard = new Storyboard();
            Storyboard.SetTargetName(moveLeftAnimation,sp.Name);
            Storyboard.SetTargetProperty(moveLeftAnimation, new PropertyPath(StackPanel.WidthProperty));
            moveLeftStoryBoard.Children.Add(moveLeftAnimation);
            LayoutRoot.Resources.Add("200", moveLeftStoryBoard); --------------------编程问答-------------------- moveLeftButton.Click += moveLeftButton_Click;

事件代码呢?贴出来看看 --------------------编程问答-------------------- 事件代码里只有1句 moveLeftStroyBoard.begin(); --------------------编程问答-------------------- 机器人消失了。。。
补充:.NET技术 ,  .NET Framework
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,