状态栏动画进度






3.72/5 (8投票s)
2004年10月27日

109721

552
在Windows状态栏中显示动画进度条,不使用进度条控件!
动画使用 Camtasia Studio 2 评估版 创建
引言
这只是一个代码片段,你可以用它轻松地在Windows状态栏中显示类似Netscape的进度条。它具有两种不同的模式:(由控件的值决定)- -1 = 动画状态,当无法计算剩余时间时
- 0-100 = 正常状态显示
它是如何工作的?
它在运行时将自己的面板添加到你的状态栏,并在自己的类中处理所有绘图。该想法基于 Matthew Hazlett 的实现
使用代码
Dim progress1 As ProgressStatus
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
progress1 = New ProgressStatus(StatusBar1)
With progress1
.Style = StatusBarPanelStyle.OwnerDraw
.MinWidth = 200
.BorderStyle = StatusBarPanelBorderStyle.Raised
End With
StatusBar1.Panels.Add(progress1)
Show()
End Sub
你可以像下面这样更改值和动画速度
progress1.progress = 53 'percent= possible values: 0-100 !
progress1.progress = -1 'animates the bar
progress1.Animspeed= 200 'ms!
关注点
没有闪烁,因为面板添加了自己的PictureBox并将其绘制到PictureBox上!
历史
- 2004年10月28日 初次发布
- 2004年10月28日(之后)第二次发布,带有自己的面板类(无闪烁)和更简洁的代码