如何使用 vb.net 自定义进度条 [英] how to customize a progress bar using vb.net
本文介绍了如何使用 vb.net 自定义进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图创建一个与值相关的颜色编码的进度条.例如,从 0 到 35,进度条应为红色,而在 35 以上,则为绿色.知道我该怎么做吗?
I was trying to creating a progress bar that was color coded in relation to the value. For example, from 0-35, the progress bar should be red-colored and above 35, green colored. Any idea how I can go about doing it?
If ProgressBar1.Value >= 35 Then
ProgressBar1.BackColor = Color.Green
Else
ProgressBar1.BackColor = Color.Red
End If
P.S 在同一个进度条中,两种颜色都必须根据值显示
P.S in the same progressbar, both the colors have to shown based on the values
推荐答案
您需要更改此设置.
Go to Project --> [WindowsApplication] Properties
On Application Tab -- Uncheck Enable Visual Styles
但是,请注意,您将看到进度条上的视觉变化.
However, be warned for there is a visual change on your progress bar as you will see.
然后你可能可以这样编码:
You could then probably code like this:
If (ProgressBar1.Value > 35) Then
ProgressBar1.ForeColor = Color.Red
Else
ProgressBar1.ForeColor = Color.Green
End If
这篇关于如何使用 vb.net 自定义进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文