我想在changeDirection按钮单击时更改我的选取框的方向。 我改变方向代码是:如何动态改变wpf选框的方向?
private void changeDirection_click(object sender, RoutedEventArgs e)
{
if (_marqueeType == MarqueeType.RightToLeft)
{
_marqueeType = MarqueeType.LeftToRight;
StartMarqueeing(_marqueeType);
}
else if (_marqueeType == MarqueeType.LeftToRight)
{
_marqueeType = MarqueeType.RightToLeft;
StartMarqueeing(_marqueeType);
}
}
而对于开始选取框代码:
public void StartMarqueeing(MarqueeType marqueeType)
{
double height = canMain.ActualHeight - marqueeList.ActualHeight;
marqueeList.Margin = new Thickness(0, 0, 0, 0);
doubleAnimation.From = -marqueeList.ActualWidth;
doubleAnimation.To = canMain.ActualWidth;
doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(_marqueeTimeInSeconds));
if (marqueeType == MarqueeType.RightToLeft)
{
Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(Canvas.Right)"));
_storyBoard.Children.Add(doubleAnimation);
_storyBoard.Begin(marqueeList, true);
}
else if (marqueeType == MarqueeType.LeftToRight)
{
Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(Canvas.Left)"));
_storyBoard.Children.Add(doubleAnimation);
_storyBoard.Begin(marqueeList, true);
}
}
现在我在这里能的方向从右到左仅第一时间而改变。 但是,当我从左到右更改它不会将选取框位置从左到右更改。
请帮我解答...........其紧急!!!!!!!!!!!
是的。请回到以前的问题,并接受你喜欢的答案。我知道你喜欢一些,因为你说过“非常感谢!!!”和“非常感谢你救我”。您可以通过点击窗口顶部的姓名来查看以前的问题。 – 2010-06-16 20:23:36
嗨,大家好..我不知道这个..我的坏...但最近我更新了状态..所以谢谢你的建议...!你能帮我解决这个问题吗? – 2010-06-17 07:28:24