C# 彩色进度条

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11712017/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 18:55:57  来源:igfitidea点击:

Colored progressbar

c#.netvisual-studio-2010progress-bar

提问by kojak

I was using a program made in C# and came across these progress bars, one of which is blue.

我正在使用一个用 C# 编写的程序并遇到这些进度条,其中一个是蓝色的。

Here's a picture of the progress bars in question:

这是有问题的进度条的图片:

http://imgur.com/xAwA4

http://imgur.com/xAwA4

The forecolor property obviously doesn't do anything, so does anyone know how to do this?

forecolor 属性显然没有做任何事情,所以有人知道如何做到这一点吗?

Thanks

谢谢

采纳答案by Cyral

Disabling Visual styles as Habib suggested will work, But if you application relies on visual styles to look nicer, You will have to use a custom progress bar.

禁用 Habib 建议的视觉样式会起作用,但是如果您的应用程序依赖视觉样式看起来更好,您将不得不使用自定义进度条。

Color Progress Bar - CodeProdject

颜色进度条 - CodeProject

TerrariViewer uses Wpf as I understand, and if your willing to use that, this is a possibility

据我了解,TerrariViewer 使用 Wpf,如果您愿意使用它,这是一种可能性

Progressbar foreground color

进度条前景色

回答by Habib

If its a winform application then do the following step

如果它是一个 winform 应用程序,则执行以下步骤

In Program.cscomment out the line

Program.cs注释掉这一行

Application.EnableVisualStyles();

In code behind:

在后面的代码中:

ProgressBar1.ForeColor = Color.Blue;
ProgressBar1.Style = ProgressBarStyle.Continuous;