我想在以下连接对话框中以红色为文本设置动画,因此标签内容将显示...
Frame 1: Connecting
Frame 2: Connecting.
Frame 3: Connecting..
Frame 4: Connecting...
Go to frame 1 if connection isn't established yet.
When connection is established: display "Connected".
我找到了有关动画文本的教程,但没有找到有关文本内容的教程。使用 WPF 可以轻松实现吗?任何帮助/教程链接将不胜感激。
这是我用来生成屏幕截图的 WPF 代码。
<Window x:Class="radar_test_ui.SerialConnectionWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Connection" SizeToContent="WidthAndHeight">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Content="COM:" Margin="5,0,5,0" />
<ComboBox Grid.Row="1" Margin="10,0,10,0">
<ComboBoxItem Content="COM1" IsSelected="True" />
<ComboBoxItem Content="COM2" />
<ComboBoxItem Content="COM3" />
</ComboBox>
<Label Grid.Row="2" Content="Baud rate:" Margin="5,10,5,0" />
<ComboBox Grid.Row="3" Margin="10,0,10,0">
<ComboBoxItem Content="9600" IsSelected="True" />
<ComboBoxItem Content="19200" />
</ComboBox>
<Separator Grid.Row="4" Margin="0,15,0,15" />
<Grid Grid.Row="5" Margin="10,0,10,10">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Content="Connecting..." FontSize="10" Width="100" VerticalAlignment="Bottom" Margin="0,0,0,-5" Name="LabelStatus" />
<Button Grid.Column="1" Content="Connect" Padding="10,3,10,3" Margin="0,0,10,0" Click="ConnectClick" />
<Button Grid.Column="2" Content="Cancel" Padding="10,3,10,3" Click="CancelClick" />
</Grid>
</Grid>
</Window>