March 8, 2021


Advances in world technology

progressbar – vb.Internet Development Bar With Text

Reverend Jim


Hello, I’m Jim, a person of DaniWeb’s moderators.


Showcased Poster

The next a person (unused b) was leftover code from earlier attempts whilst figuring the current variation out. I just neglected to take away it. Thanks for noting what could be improved.


by Reverend Jim

Member Avatar

Hi RJ –

I would like to use your CustomProgress handle with a StatusStrip manage throughout style-time (by using the IDE). Can you demonstrate me how to add the CustomProgress command to the StatusStrip control’s fall-down list of controls?

This would enable me to use your CustomProgress control alternatively of the typical ProgressBar management with the StatusStrip control on my sort. Thanks.


by [email protected]

Member Avatar

Hi RJ –

This is what I was able to create as a solution to my inquery..


Here is what I have place collectively (it may perhaps not be the “most effective” technique, so I would recognize it if you have any tips)…

' made-toolstripprogressbar-in-c-sharp-home windows-kinds

Imports Program.Home windows.Kinds.Design '...demanded for ToolStripItemDesignerAvailability

Community Class ToolStripProgressBarC
    Inherits MyCustomToolStripControlHost

    ' the foundation constructor passing in a myCustomProgressBar occasion
    General public Sub New()
        MyBase.New(New myCustomProgressBar)
        CType(Manage, myCustomProgressBar).Style = ProgressBarStyle.Ongoing
    Finish Sub

    General public ReadOnly House ProgressBarControl As myCustomProgressBar
            Return CType(Handle, myCustomProgressBar)
        Conclude Get
    Conclusion Property

    '...expose the myCustomProgressBar.Benefit as a residence
    Public Home Price As Integer
            Return Me.ProgressBarControl.Value
        Conclusion Get
            Me.ProgressBarControl.Benefit = Benefit
        End Established
    Conclude Assets
Conclusion Course

General public Course MyCustomToolStripControlHost
    Inherits ToolStripControlHost

    Community Sub New()
        MyBase.New(New Management())
    Stop Sub

    Public Sub New(ByVal c As Regulate)
    Close Sub
Stop Course

Public Course myCustomProgressBar


    Inherits ProgressBar

    General public Overrides Property Textual content As String
    '   WM_PAINT = &HF  decimal value = 15...CDec("&H0F") = 15
    Private Const WmPaint = 15

    '...WndProc receives all messages directed to the existing window. In purchase to
    '   prevent overwriting your text, make sure the default code executes initial,
    '   then get in touch with the custom made regime to exhibit the overlaid textual content

    Guarded Overrides Sub WndProc(ByRef m As Process.Windows.Sorts.Information)
        If m.Msg = WmPaint Then
        Conclusion If
    Conclude Sub

    Personal Sub PaintText()

        Dim s As String = Text

        '...exhibit both a proportion or custom made textual content

        If s = "" Then
            Dim percent = CInt(100 * (Worth - Least) / (Maximum - Least))
            s = per cent.ToString & "%"
        Conclude If

        '...get the graphics object and compute drawing parameters based mostly on the latest Font specs

        Making use of g As Graphics = Me.CreateGraphics()
            Dim textSize As SizeF = g.MeasureString(s, Me.Font)
            Working with b = New SolidBrush(ForeColor)
                g.DrawString(s, Me.Font, Brushes.Black, CSng(Me.Width / 2 - textSize.Width / 2), CSng(Me.Height / 2 - textSize.Height / 2))
            Stop Using
        Finish Making use of

    Finish Sub

Conclude Course

Thank you all over again for your assistance!


by [email protected]