Web Browser & Status Strip Question

How do i sync my status Strip ProgressBar & StatusLabel to reflect my web browser actions like loading etc, so that it looks like its doing something. Also when loading my form if i want to add a splash screen, how do i make it so that it show what is loaded or fake it.


Answer this question

Web Browser & Status Strip Question

  • Dans.

    IceAngel89,

    Try the following code:

    Public Class ProgressStatus : Inherits StatusBar

    Public progressBar As New progressBar

    Private _progressBar As Integer = -1

     

     

    Sub New()

        progressBar.Hide()

     

        Me.Controls.Add(progressBar)

    End Sub

     

     

    Public Property setProgressBar() As Integer

        Get

            Return _progressBar

        End Get

        Set(ByVal Value As Integer)

            _progressBar = Value

            Me.Panels(_progressBar).Style = StatusBarPanelStyle.OwnerDraw

        End Set

    End Property

     

     

    Private Sub Reposition(ByVal sender As Object, _

         ByVal sbdevent As System.Windows.Forms.StatusBarDrawItemEventArgs) _

         Handles MyBase.DrawItem

        progressBar.Location = New Point(sbdevent.Bounds.X, _

           sbdevent.Bounds.Y)

        progressBar.Size = New Size(sbdevent.Bounds.Width, _

           sbdevent.Bounds.Height)

        progressBar.Show()

    End Sub

    End Class

    Add it to your project is easy, for easy access we will put in its own sub:

    Public StatusBar As New ProgressStatus

     

    Private Sub InitializeStatusBar()

        Dim info = New System.Windows.Forms.StatusBarPanel

        Dim progress = New System.Windows.Forms.StatusBarPanel

     

     

        info.Text = "Ready"

        info.Width = 100

     

        progress.AutoSize = _

           System.Windows.Forms.StatusBarPanelAutoSize.Spring

     

        With StatusBar

            .Panels.Add(info)

            .Panels.Add(progress)

            .ShowPanels = True

            .setProgressBar = 1

            .progressBar.Minimum = 0

            .progressBar.Maximum = 100

        End With

     

        Me.Controls.Add(StatusBar)

    End Sub

     

    Private Sub Form1_Load(ByVal sender As System.Object, _

          ByVal e As System.EventArgs) Handles MyBase.Load

        InitializeStatusBar()

        StatusBar.progressBar.Value = 50

        End Sub

    There is also an article Titled: A class to put a ProgressBar or any control into a StatusBar, hope it helps, too :-)

    http://www.codeproject.com/vb/net/StatusProgressBar.asp

     



  • Web Browser & Status Strip Question