【VB新手向】自制进度条
进度条的作用就是显示一个进度,我觉得这东西我们没必要做得和别的程序一样。不就是个UI么。要有自己的个性,没必要跟风,微软提供的那个进度条问题很多。不如自己做一个这种东西。
图中的这个进度条是用图片框和命令按钮做的。很美观,而且也起到了显示进度的功能,也很简单。VERSION 5.00
Begin VB.Form frmMain
BorderStyle = 1'Fixed Single
Caption = "自制进度条"
ClientHeight = 1095
ClientLeft = 45
ClientTop = 375
ClientWidth = 4575
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 73
ScaleMode = 3'Pixel
ScaleWidth = 305
StartUpPosition = 3'窗口缺省
Begin VB.HScrollBar HSValue
Height = 255
LargeChange = 2048
Left = 120
TabIndex = 2
TabStop = 0 'False
Top = 720
Width = 4335
End
Begin VB.PictureBox picProgress
Height = 255
Left = 120
ScaleHeight = 13
ScaleMode = 3'Pixel
ScaleWidth = 285
TabIndex = 0
Top = 120
Width = 4335
Begin VB.CommandButton cmdProgress
Enabled = 0 'False
Height = 195
Left = 0
Style = 1'Graphical
TabIndex = 1
Top = 0
Width = 735
End
End
Begin VB.Label lblPrompt
AutoSize = -1'True
Caption = "拖动下面的这个滚动条可以看到上面的进度条的变化。"
Height = 180
Left = 120
TabIndex = 3
Top = 480
Width = 4320
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
SetProgressValue 0
End Sub
Sub SetProgressValue(ByVal Value As Double)
cmdProgress.Width = Value * picProgress.ScaleWidth
End Sub
Private Sub HSValue_Change()
SetProgressValue CDbl(HSValue.Value) / HSValue.Max
End Sub
Private Sub HSValue_Scroll()
HSValue_Change
End SubSRC: 这个还不错
论坛有你真的精彩~
页:
[1]