vb里的进度条怎么做
发布网友
发布时间:2022-05-31 22:42
我来回答
共3个回答
热心网友
时间:2023-04-25 18:26
系统自带进度条控件,在控件栏右键→部件 然后选择 microsoft windows common controls 6.0
有个自带的进度条
你也可以用shape picture image等控件模拟进度条
也可以自己手动写一个进度条控件
不过个人觉得用picturebox和image 模拟进度条方便好看点,可以设置一个漂亮的图片
热心网友
时间:2023-04-25 18:27
如果想要好看的进度条,一是自己写,再就是下载一个进度条控件,网上有的
热心网友
时间:2023-04-25 18:27
VERSION 5.00
Begin VB.UserControl UserControl1
ClientHeight = 510
ClientLeft = 0
ClientTop = 0
ClientWidth = 8055
ScaleHeight = 510
ScaleWidth = 8055
Begin VB.PictureBox Picture1
BackColor = &H8000000E&
Height = 525
Left = 0
ScaleHeight = 465
ScaleWidth = 11115
TabIndex = 0
Top = 0
Width = 11175
Begin VB.Label lblMsg
Alignment = 2 'Center
BackColor = &H80000009&
BackStyle = 0 'Transparent
Caption = "进度条"
ForeColor = &H000000FF&
Height = 180
Left = 5160
TabIndex = 1
Top = 135
Width = 600
End
Begin VB.Label lblColor
BackColor = &H00C00000&
Caption = "Label1"
Height = 495
Left = 0
TabIndex = 2
Top = 0
Width = 3495
End
End
End
Attribute VB_Name = "UserControl1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Event Click()
Event ValueAdd(v As Long, ss As String)
Dim Maxv As Long, vv As Long
Private Sub Label1_Click()
'RaiseEvent Click
End Sub
Private Sub UserControl_Initialize()
On Error Resume Next
lblColor.Left = 0
lblColor.Width = 0
Picture1.Top = 0
Picture1.Left = 0
Picture1.Width = UserControl.Width
Picture1.Height = UserControl.Height
lblMsg.Width = Picture1.Width
lblMsg.Left = 0
lblMsg = ""
lblColor = ""
lblMsg.Top = (Picture1.Height - lblMsg.Height) / 2 - 15
lblColor.Top = 0
lblColor.Height = Picture1.Height
End Sub
Public Property Let Caption(Caption As String)
lblMsg.Caption = Caption
End Property
Public Property Get Caption() As String
Caption = lblMsg.Caption
End Property
Public Property Let MaxValue(v As Long)
Maxv = v
End Property
Public Property Get MaxValue() As Long
MaxValue = Maxv
End Property
Public Property Let Value(v As Long)
vv = v
If Maxv = 0 Then Exit Property
lblColor.Width = (v / Maxv) * UserControl.Width
End Property
Public Property Get Value() As Long
Value = vv
End Property
Private Sub UserControl_Resize()
UserControl_Initialize
End Sub
Public Function ValueAdd(v As Long, Optional ss As String)
On Error Resume Next
vv = vv + v
If Maxv = 0 Then Exit Function
lblColor.Width = (vv / Maxv) * UserControl.Width
If IsMissing(ss) Then Exit Function
If ss = "" Then Exit Function
lblMsg.Caption = ss & " " & vv & "/" & Maxv & " ..."
End Function
热心网友
时间:2023-04-25 18:26
系统自带进度条控件,在控件栏右键→部件 然后选择 microsoft windows common controls 6.0
有个自带的进度条
你也可以用shape picture image等控件模拟进度条
也可以自己手动写一个进度条控件
不过个人觉得用picturebox和image 模拟进度条方便好看点,可以设置一个漂亮的图片
热心网友
时间:2023-04-25 18:27
如果想要好看的进度条,一是自己写,再就是下载一个进度条控件,网上有的
热心网友
时间:2023-04-25 18:27
VERSION 5.00
Begin VB.UserControl UserControl1
ClientHeight = 510
ClientLeft = 0
ClientTop = 0
ClientWidth = 8055
ScaleHeight = 510
ScaleWidth = 8055
Begin VB.PictureBox Picture1
BackColor = &H8000000E&
Height = 525
Left = 0
ScaleHeight = 465
ScaleWidth = 11115
TabIndex = 0
Top = 0
Width = 11175
Begin VB.Label lblMsg
Alignment = 2 'Center
BackColor = &H80000009&
BackStyle = 0 'Transparent
Caption = "进度条"
ForeColor = &H000000FF&
Height = 180
Left = 5160
TabIndex = 1
Top = 135
Width = 600
End
Begin VB.Label lblColor
BackColor = &H00C00000&
Caption = "Label1"
Height = 495
Left = 0
TabIndex = 2
Top = 0
Width = 3495
End
End
End
Attribute VB_Name = "UserControl1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Event Click()
Event ValueAdd(v As Long, ss As String)
Dim Maxv As Long, vv As Long
Private Sub Label1_Click()
'RaiseEvent Click
End Sub
Private Sub UserControl_Initialize()
On Error Resume Next
lblColor.Left = 0
lblColor.Width = 0
Picture1.Top = 0
Picture1.Left = 0
Picture1.Width = UserControl.Width
Picture1.Height = UserControl.Height
lblMsg.Width = Picture1.Width
lblMsg.Left = 0
lblMsg = ""
lblColor = ""
lblMsg.Top = (Picture1.Height - lblMsg.Height) / 2 - 15
lblColor.Top = 0
lblColor.Height = Picture1.Height
End Sub
Public Property Let Caption(Caption As String)
lblMsg.Caption = Caption
End Property
Public Property Get Caption() As String
Caption = lblMsg.Caption
End Property
Public Property Let MaxValue(v As Long)
Maxv = v
End Property
Public Property Get MaxValue() As Long
MaxValue = Maxv
End Property
Public Property Let Value(v As Long)
vv = v
If Maxv = 0 Then Exit Property
lblColor.Width = (v / Maxv) * UserControl.Width
End Property
Public Property Get Value() As Long
Value = vv
End Property
Private Sub UserControl_Resize()
UserControl_Initialize
End Sub
Public Function ValueAdd(v As Long, Optional ss As String)
On Error Resume Next
vv = vv + v
If Maxv = 0 Then Exit Function
lblColor.Width = (vv / Maxv) * UserControl.Width
If IsMissing(ss) Then Exit Function
If ss = "" Then Exit Function
lblMsg.Caption = ss & " " & vv & "/" & Maxv & " ..."
End Function