关于VB.NET进度条的实例
2个回答
推荐于2017-12-16
展开全部
该实例有很多实现方法,下面介绍一种不同的给你:
首先要在窗体中载入以下控件:progressbar(进度条),label(用来实时显示文本提示),两个timer(分别控制进度条进度的增减),然后用以下代码就能实现:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer1.Interval = 500
Timer2.Interval = 500
ProgressBar1.Value = 0
ProgressBar1.Maximum = 100
ProgressBar1.Minimum = 0
End Sub
'上述过程是设置控件的初始值,也可以在属性面板设置
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar1.Value += 1
Label1.Text = "当前完成" & ProgressBar1.Value & "%"
If (ProgressBar1.Value = 100) Then
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub
'timer1用来控制进度的增加
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
ProgressBar1.Value -= 1
Label1.Text = "当前完成" & ProgressBar1.Value & "%"
If (ProgressBar1.Value = 0) Then
Timer1.Enabled = True
Timer2.Enabled = False
End If
End Sub
'time2用来控制进度的减少
End Class
首先要在窗体中载入以下控件:progressbar(进度条),label(用来实时显示文本提示),两个timer(分别控制进度条进度的增减),然后用以下代码就能实现:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer1.Interval = 500
Timer2.Interval = 500
ProgressBar1.Value = 0
ProgressBar1.Maximum = 100
ProgressBar1.Minimum = 0
End Sub
'上述过程是设置控件的初始值,也可以在属性面板设置
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar1.Value += 1
Label1.Text = "当前完成" & ProgressBar1.Value & "%"
If (ProgressBar1.Value = 100) Then
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub
'timer1用来控制进度的增加
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
ProgressBar1.Value -= 1
Label1.Text = "当前完成" & ProgressBar1.Value & "%"
If (ProgressBar1.Value = 0) Then
Timer1.Enabled = True
Timer2.Enabled = False
End If
End Sub
'time2用来控制进度的减少
End Class
2013-08-08
展开全部
给你个参考一下
private sub progressbar_run()
dim i, re as integer
me.progressbar1.maximum = 5000
me.progressbar1.minimum = 1
me.progressbar1.step = 1
me.progressbar1.value = 1
for i = 1 to 5000
系统处理过程:
next
me.progressbar1.value = 1
end sub
private sub progressbar_run()
dim i, re as integer
me.progressbar1.maximum = 5000
me.progressbar1.minimum = 1
me.progressbar1.step = 1
me.progressbar1.value = 1
for i = 1 to 5000
系统处理过程:
next
me.progressbar1.value = 1
end sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询