2012-10-09 38 views

回答

1

下面是做到這一點的方法之一。當然還有更多。

將MoveMarqueeText函數添加到OnNavigatedTo事件中的Composition Target Rending事件中。

protected override void OnNavigatedTo(NavigationEventArgs e) 
{ 
    CompositionTarget.Rendering += MoveMarqueeText; 
} 

添加一個函數,它會刪除字符串的第一個字符,並追加到尾部。

void MoveMarqueeText(object sender, object e) 
{ 
    Marquee.Text = Marquee.Text.Substring(1) + Marquee.Text.Substring(0,1); 
} 

使用XAML

<TextBlock Text="woot hey woot woot hey woot hey woot woot hey woot hey woot woot hey" Width="250" x:Name="Marquee" TextWrapping="NoWrap"> 

要慢下來添加條件語句和計數器增量在MoveMarqueeText功能,使其減速將基於時間的,在你的條件使用定時器。

+0

它的工作,但它不是很好的工作。文字閃爍。 – GermanSniper

相關問題