Oct 20, 2011 at 3:21 PM

Is there sample code of how to link a progressbar to a map or legend? Previously we linked a spatialstatusstrip to monitor load progess in the label and progress controls I have looked at the DemoMap but it does not help.


Oct 20, 2011 at 4:26 PM

Hi Terry. What's unclear about the DemoMap example? Try adding the SimpleStatusControl.cs to your project etc.

Oct 20, 2011 at 8:11 PM

Am I on the right track here? The problem with this cod eis that the panel only has Caption and Width.

Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports DotSpatial.Controls
Imports DotSpatial.Controls.Header
Imports System.ComponentModel.Composition
Imports System.Windows.Forms
Imports System.ComponentModel

Namespace SurvCode

    Public Class SimpleStatusControl

        Implements IStatusControl

        Implements IPartImportsSatisfiedNotification

        <Import("Shell", GetType(ContainerControl))> _
        Private Property Shell() As ContainerControl
                Return m_Shell
            End Get
            Set(value As ContainerControl)
                m_Shell = Value
            End Set
        End Property
        Private m_Shell As ContainerControl

        Private statusStrip As System.Windows.Forms.StatusStrip
        Private defaultStatusPanel As StatusPanel

        ''' <summary>
        ''' Initializes a new instance of the SimpleStatusControl class.
        ''' </summary>

        Public Sub New()
        End Sub

        Public Sub Add(panel As DotSpatial.Controls.Header.StatusPanel) Implements DotSpatial.Controls.Header.IStatusControl.Add

            Dim myLabel As New ToolStripStatusLabel()

            myLabel.Name =

            myLabel.Text = panel.Caption

            myLabel.Width = panel.Width

            'panel.PropertyChanged += Function(sender As Object, e As PropertyChangedEventArgs) Do


        End Sub

        Public Sub Progress(key As String, percent As Integer, message As String) Implements DotSpatial.Data.IProgressHandler.Progress

            defaultStatusPanel.Caption = message

        End Sub

        Public Sub OnImportsSatisfied() Implements System.ComponentModel.Composition.IPartImportsSatisfiedNotification.OnImportsSatisfied

            statusStrip = New StatusStrip()

            statusStrip.Location = New System.Drawing.Point(0, 285)
            statusStrip.Name = "statusStrip1"
            statusStrip.Size = New System.Drawing.Size(508, 22)
            statusStrip.TabIndex = 0
            statusStrip.Text = [String].Empty

            'adding the status strip control

            'adding one initial status panel to the status strip control
            defaultStatusPanel = New StatusPanel()

        End Sub

        Public Sub Remove(panel As StatusPanel)


        End Sub

    End Class

End Namespace

Oct 20, 2011 at 8:43 PM

That seems okay, though you've not provided code that would update the caption if a panel is added.

By the way, most of the time we see people calling Progress(,,,) which primarily needs a message or percent.