📄 gradient progressbar.ctl
字号:
VERSION 5.00
Begin VB.UserControl Progress
BackStyle = 0 'Transparent
ClientHeight = 375
ClientLeft = 0
ClientTop = 0
ClientWidth = 3000
ScaleHeight = 25
ScaleMode = 3 'Pixel
ScaleWidth = 200
Begin VB.PictureBox pic1
AutoRedraw = -1 'True
Height = 375
Left = 0
ScaleHeight = 21
ScaleMode = 3 'Pixel
ScaleWidth = 196
TabIndex = 0
Top = 0
Width = 3000
Begin VB.Label lbl
BackStyle = 0 'Transparent
Height = 375
Left = 0
TabIndex = 1
Top = 0
Width = 3015
End
End
End
Attribute VB_Name = "Progress"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
'**********************************
'* CODE BY: PATRICK MOORE (ZELDA) *
'* Feel free to re-distribute or *
'* Use in your own projects. *
'* Giving credit to me would be *
'* nice :) *
'* *
'* Please vote for me if you find *
'* this code useful :] -Patrick *
'**********************************
'
'PS: Please look for more submissions to PSC by me
' shortly. I've recently been working on a lot
' :)) All my submissions are under author name
' "Patrick Moore (Zelda)"
Public Percent As Integer
Public StartColor As OLE_COLOR
Public EndColor As OLE_COLOR
Public Sub Refresh()
Dim X As Integer
'If the first color is different from the startcolor
'(meaning the user changed it) re-gradient the picturebox
'Resize the label to display the proper percent
If pic1.Point(0, 0) <> StartColor Or pic1.Point(pic1.Width, pic1.Height) <> EndColor Then
Gradient pic1, StartColor, EndColor
End If
'Draw gray lines to accurately show the percent
For X = (Percent * (pic1.Width / 100)) + 1 To pic1.Width
pic1.Line (X, 0)-(X, pic1.Height), "&H8000000F", BF
Next X
End Sub
Private Sub UserControl_Resize()
'Re-align the picturebox to the size
'of the progressbar
pic1.Width = UserControl.ScaleWidth
pic1.Height = UserControl.ScaleHeight
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -