有没有办法为ListView制作加载栏(进度条)?

时间:2013-01-31 06:29:34

标签: winforms listview progress-bar vb.net-2010

我一直计划为ProgressBar制作ListView,以了解已加载了多少百分比。有没有人有任何想法?

Public Class Form1

     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            ProgressBar1.Value += 2
            If ProgressBar1.Value >= 100 Then
                ProgressBar1.Value = 100
            End If
        End Sub

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            ProgressBar1.Minimum = 0
            ProgressBar1.Maximum = 100
            ProgressBar1.Value = 0
        End Sub
    End Class

1 个答案:

答案 0 :(得分:3)

您有正确的想法,但您可能希望在加载listview的代码中设置progressbar值而不是timer tick事件,因为您不知道预先需要多长时间。希望您可以获得已加载的列表视图的粗略百分比,然后将该值分配给ProgressBar1.Value