我使用的是ProgressBar
,但是当我更改主题时,它看起来会有所不同。
我从个性化选项中更改了windows主题(即右键单击桌面) windows经典主题(即基本和高对比度主题)如下:
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"
Background="Transparent">
<ProgressBar IsIndeterminate="True" Height="20" Width="300"
VerticalAlignment="Center" BorderThickness="0"
BorderBrush="Transparent" HorizontalAlignment="Center"
Foreground="#0A8098" >
<ProgressBar.Background>
<ImageBrush ImageSource="/ClientApplication;component/Images/ProgressBackground.png"/>
</ProgressBar.Background>
<ProgressBar.Clip>
<RectangleGeometry RadiusX="20.5" RadiusY="20.5" Rect="0,0,300,19"/>
</ProgressBar.Clip>
</ProgressBar>
<TextBlock Text="LOADING PLEASE WAIT" Margin="0 10 0 0" VerticalAlignment="Center"
HorizontalAlignment="Center" Foreground="#FFFFFF" />
</StackPanel>
和图片:
然后我再次将Windows经典主题更改为Windows 7(即航空主题),
但我想要第一个但没有影响/改变主题。
任何想法怎么办? 谢谢。
答案 0 :(得分:1)
ProgressBar
取决于Windows主题。您可以创建自己的进度条并在需要时显示/隐藏它。
唯一的缺点是,如果您希望将其与进度百分比挂钩,则需要手动编写一些逻辑。
使用WPF,您可以绘制自己的进度条并根据需要设置动画。
<Rectangle Name="LoadingRectangle" Stroke="Black" Fill="#C0000000" Visibility="{Binding Path=LoadingIcon}" />
<Canvas Name="LoadingIcon" RenderTransformOrigin="0.5,0.5" Width="120" Height="120" Visibility="{Binding Path=LoadingIcon}" >
<Ellipse Width="19.5" Height="19.5" Canvas.Left="20.1696" Canvas.Top="9.76358" Stretch="Fill" Fill="DarkGoldenrod"/>
<Ellipse Width="18" Height="18" Canvas.Left="2.86816" Canvas.Top="29.9581" Stretch="Fill" Fill="DarkGoldenrod" OpacityMask="#E9000000" />
<Ellipse Width="17" Height="17" Canvas.Left="5.03758e-006" Canvas.Top="57.9341" Stretch="Fill" Fill="DarkGoldenrod" OpacityMask="#E1000000" />
<Ellipse Width="16" Height="16" Canvas.Left="12" Canvas.Top="85" Stretch="Fill" Fill="DarkGoldenrod" OpacityMask="#D2000000" />
<Ellipse Width="15" Height="15" Canvas.Left="37" Canvas.Top="102" Stretch="Fill" Fill="DarkGoldenrod" OpacityMask="#BC000000" />
<Ellipse Width="14" Height="14" Canvas.Left="66" Canvas.Top="101" Stretch="Fill" Fill="DarkGoldenrod" OpacityMask="#9C000000" />
<Ellipse Width="13" Height="13" Canvas.Left="91" Canvas.Top="86" Stretch="Fill" Fill="DarkGoldenrod" OpacityMask="#7B000000" />
<Ellipse Width="11" Height="11" Canvas.Left="106" Canvas.Top="65" Stretch="Fill" Fill="DarkGoldenrod" OpacityMask="#49000000" />
<Ellipse Width="10" Height="10" Canvas.Left="104" Canvas.Top="39" Stretch="Fill" Fill="DarkGoldenrod" OpacityMask="#27000000" />
<Ellipse Width="21.835" Height="21.862" Canvas.Left="47.2783" Canvas.Top="0.5" Stretch="Fill" Fill="DarkGoldenrod"></Ellipse>
<Canvas.RenderTransform>
<RotateTransform x:Name="SpinnerRotate" Angle="0" />
</Canvas.RenderTransform>
<Canvas.Triggers>
<EventTrigger RoutedEvent="ContentControl.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="SpinnerRotate" Storyboard.TargetProperty="(RotateTransform.Angle)" From="0" To="360" Duration="0:0:01" RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Canvas.Triggers>
</Canvas>