VB.NET 进度条与状态条的使用

Private strDate = New System.Windows.Forms.StatusBarPanel
    Private StrCount = New System.Windows.Forms.StatusBarPanel
    Private info = New System.Windows.Forms.StatusBarPanel
    Private progress = New System.Windows.Forms.StatusBarPanel
    Private StatusBar As New ProgressStatus ''状态条中加入进度条
Private   Sub InitializeStatusBar()

        info.Text 
= "Ready"
        info.Width 
= 100
        StrCount.AutoSize 
= System.Windows.Forms.StatusBarPanelAutoSize.Contents
        StrCount.Alignment 
= HorizontalAlignment.Center
        StrCount.Text 
= "完成 0 条记录"
        progress.AutoSize 
= System.Windows.Forms.StatusBarPanelAutoSize.Spring
        strDate.AutoSize 
= System.Windows.Forms.StatusBarPanelAutoSize.Contents
        strDate.Text 
= System.DateTime.Now
        strDate.Alignment 
= HorizontalAlignment.Right

        
With StatusBar
            .Panels.Add(info)
            .Panels.Add(progress)
            .Panels.Add(StrCount)
            .Panels.Add(strDate)
            .ShowPanels 
= True
            .setProgressBar 
= 1
            .progressBar.Minimum 
= 0
            .progressBar.Maximum 
= 100
        
End With

        
Me.Controls.Add(StatusBar)
    
End Sub
 
组件类:ProgressStatus.vb
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 ObjectByVal 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


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值