📄 form1.frm
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form Form1
Caption = "进度条"
ClientHeight = 3270
ClientLeft = 1845
ClientTop = 2280
ClientWidth = 7500
LinkTopic = "Form1"
LockControls = -1 'True
PaletteMode = 1 'UseZOrder
ScaleHeight = 3270
ScaleWidth = 7500
Begin VB.Frame Frame1
Caption = "状态属性"
Height = 1950
Left = 600
TabIndex = 1
Top = 360
Width = 6180
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 375
Left = 240
TabIndex = 8
Top = 1320
Width = 1335
End
Begin VB.ComboBox cboAlign
Height = 300
ItemData = "form1.frx":0000
Left = 240
List = "form1.frx":000D
Style = 2 'Dropdown List
TabIndex = 6
Top = 360
Width = 2415
End
Begin VB.TextBox txtMin
Height = 285
Left = 4560
TabIndex = 5
Text = "txtMin"
Top = 840
Width = 1335
End
Begin VB.TextBox txtMax
Height = 285
Left = 4560
TabIndex = 4
Text = "txtMax"
Top = 360
Width = 1335
End
Begin VB.CommandButton cmdTestBar
Caption = "测试"
Height = 375
Left = 4560
TabIndex = 2
Top = 1320
Width = 1335
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "最小值"
Height = 180
Left = 3240
TabIndex = 7
Top = 840
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "最大值"
Height = 180
Left = 3240
TabIndex = 3
Top = 360
Width = 540
End
End
Begin ComctlLib.ProgressBar prgTestBar
Align = 2 'Align Bottom
Height = 405
Left = 0
TabIndex = 0
Top = 2865
Width = 7500
_ExtentX = 13229
_ExtentY = 714
_Version = 327682
Appearance = 1
End
End
Attribute VB_Name = "form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Sub CenterFrame()
Frame1.Move _
(form1.ScaleWidth / 2) - (Frame1.Width / 2), _
(form1.ScaleHeight / 2) - (Frame1.Height / 2), _
Frame1.Width, _
Frame1.Height
End Sub
Private Sub cboAlign_Click()
prgTestBar.Align = cboAlign.ListIndex
If prgTestBar.Align = 0 Then
prgTestBar.Width = Frame1.Width
prgTestBar.Left = Frame1.Left
prgTestBar.Top = Frame1.Top + Frame1.Height + 200
End If
End Sub
Private Sub cmdExit_Click()
Unload form1
End
End Sub
Private Sub cmdTestBar_Click()
Dim intBarValue As Integer
On Error GoTo ErrorHandler
prgTestBar.Min = CInt(txtMin)
prgTestBar.Max = CInt(txtMax)
For intBarValue = prgTestBar.Min To prgTestBar.Max
prgTestBar.Value = intBarValue
DoEvents
Next
prgTestBar.Value = prgTestBar.Min
Exit Sub
ErrorHandler:
Select Case Err.Number
Case Is = 13
MsgBox "Invalid property value", , App.ProductName
Case Is = 6
MsgBox "Property value too large", , App.ProductName
Case Else
MsgBox "Maximum value must be greater than Minimum value", , App.ProductName
End Select
Exit Sub
End Sub
Private Sub Form_Load()
CenterFrame
'缺省状态值
txtMin = 0
txtMax = 100
cboAlign.ListIndex = 1
End Sub
Private Sub Form_Resize()
CenterFrame
cboAlign_Click
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set form1 = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -