Visual studio 进度条控件:蓝色

Visual studio Progressbar control: blue color

使用进度条控件我只能使用默认的绿色。

查看 windows 7 我注意到这个控件,请参见下图。

我找到这篇文章: Windows ProgressBar

我的问题是,如何在Visual Studio 2013 中使用此控件标记蓝色进度条?

谢谢

编辑:我想要蓝色,而不是红色、黄色或绿色。这个控件叫做 "meter".

我找到了改变颜色的方法,但是没有蓝色... 但我想它是通过同样的方式完成的

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        MyProgressBar1.pdColor = myProgressBar.ProgressBarColor.red
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        MyProgressBar1.Increment(1)
    End Sub
End Class

Public Class myProgressBar
    Inherits ProgressBar

    Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    Public Sub New()
    End Sub

    Enum ProgressBarColor
        green = 1
        red = 2
        yellow = 3
    End Enum

    Private pbColor As ProgressBarColor
    Public Property pdColor As ProgressBarColor
        Get
            Return pbColor
        End Get
        Set(value As ProgressBarColor)
            pbColor = value
            SendMessage(Me.Handle, 1040, value, 0)
        End Set
    End Property

End Class

抱歉,它无法按照说明访问:

In Windows Vista, progressbars come in different flavors, the most common progressbar being the green one. However, there are also the red and yellow versions as well (there is a blue version, known as a meter, but that is inaccessible). The progressbar colors seem to correspond to specific progressbar states. You can set these states using the PBM_SETSTATE [0x40F] message. The states are PBST_NORMAL [0x0001], PBST_ERROR [0x0002] and PBST_PAUSE [0x0003].

但如果您有兴趣,可以访问红色和黄色 使用以下内容:

Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Enum ProgressBarColor
    Green = &H1
    Red = &H2
    Yellow = &H3
End Enum

Private Shared Sub ChangeProgBarColor(ByVal ProgressBar_Name As ProgressBar, ByVal ProgressBar_Color As ProgressBarColor)
    SendMessage(ProgressBar_Name.Handle, &H410, ProgressBar_Color, 0)
End Sub

使用示例:

ChangeProgBarColor(Progress_Bar, ProgressBarColor.Red)