gpt4 book ai didi

wpf - Windows 8 WPF 进度条没有发光动画

转载 作者:行者123 更新时间:2023-12-01 22:37:22 25 4
gpt4 key购买 nike

Windows 窗体应用程序中的进度条具有标准的“闪耀”动画,但是当我尝试在 WPF 中添加进度条时,默认情况下我不会得到这样的动画。我们如何在 Windows 8 中使用 WPF 恢复此功能?

Windows 窗体

WPF

最佳答案

这是一个相当奇怪的修复,但您需要在应用程序中启用 Windows 窗体样式才能使用“光泽”。我就是这样做的。

  1. 在项目中添加对 System.Windows.Forms 的引用
  2. 转至项目设置页面并点击查看应用程序事件
  3. 使用以下代码(在 VB.NET、C# 中类似)将处理程序添加到您的 Application.Startup(另外,如果您需要包含参数,请这样做)
Class Application

' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
' can be handled in this file.

Private Sub Application_Startup() Handles Me.Startup
System.Windows.Forms.Application.EnableVisualStyles()
End Sub

End Class

似乎很奇怪,您必须调用此函数才能使 WPF 进度条正常工作,但该代码对我有用。

关于wpf - Windows 8 WPF 进度条没有发光动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17672058/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com