XAML:
<Window x:Class="MyWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="DownLoad Demo" Height="350" Width="525" Loaded="Window_Loaded">
<Window.Background>
<LinearGradientBrush>
<GradientStop Color="Red" Offset="0"></GradientStop>
<GradientStop Color="Yellow" Offset="0.5"></GradientStop>
</LinearGradientBrush>
</Window.Background>
<Grid>
<Label x:Name="txtWords"></Label>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
<Button Content="start download" Width="120" Height="23" Margin="8" Click="Button_Click">
<Button.Effect>
<DropShadowEffect Color="Blue" BlurRadius="1"></DropShadowEffect>
</Button.Effect>

本文展示了如何在WPF应用程序中创建一个带有进度条的下载功能。利用BackgroundWorker组件进行异步操作,实时更新进度,并提供开始和取消下载的按钮功能。
最低0.47元/天 解锁文章
1875

被折叠的 条评论
为什么被折叠?



