📄 progressbar.ctl
字号:
'FORE COLOUR
c(16) = RGB(192, 204, 62)
ElseIf Theme = 3 Then
'BACK
c(0) = RGB(242, 248, 243)
c(1) = RGB(242, 248, 243)
c(2) = RGB(211, 233, 213)
c(3) = RGB(211, 233, 213)
'\
c(4) = RGB(182, 226, 186)
c(5) = RGB(182, 226, 186)
c(6) = RGB(215, 239, 217)
c(7) = RGB(215, 239, 217)
'FRONT
c(8) = RGB(223, 251, 225)
c(9) = RGB(223, 251, 225)
c(10) = RGB(133, 239, 142)
c(11) = RGB(133, 239, 142)
'\
c(12) = RGB(57, 203, 70)
c(13) = RGB(57, 203, 70)
c(14) = RGB(187, 237, 191)
c(15) = RGB(187, 237, 191)
'FORE COLOUR
c(16) = RGB(62, 204, 74)
ElseIf Theme = 4 Then
'BACK
c(0) = RGB(242, 248, 247)
c(1) = RGB(242, 248, 247)
c(2) = RGB(211, 233, 231)
c(3) = RGB(211, 233, 231)
'\
c(4) = RGB(182, 226, 222)
c(5) = RGB(182, 226, 222)
c(6) = RGB(215, 239, 237)
c(7) = RGB(215, 239, 237)
'FRONT
c(8) = RGB(223, 251, 249)
c(9) = RGB(223, 251, 249)
c(10) = RGB(133, 239, 230)
c(11) = RGB(133, 239, 230)
'\
c(12) = RGB(57, 203, 190)
c(13) = RGB(57, 203, 190)
c(14) = RGB(187, 237, 233)
c(15) = RGB(187, 237, 233)
'FORE COLOUR
c(16) = RGB(62, 204, 192)
ElseIf Theme = 5 Then
'BACK
c(0) = RGB(243, 242, 248)
c(1) = RGB(243, 242, 248)
c(2) = RGB(213, 211, 233)
c(3) = RGB(213, 211, 233)
'\
c(4) = RGB(186, 182, 226)
c(5) = RGB(186, 182, 226)
c(6) = RGB(217, 215, 239)
c(7) = RGB(217, 215, 239)
'FRONT
c(8) = RGB(225, 223, 251)
c(9) = RGB(225, 223, 251)
c(10) = RGB(142, 133, 239)
c(11) = RGB(142, 133, 239)
'\
c(12) = RGB(70, 57, 203)
c(13) = RGB(70, 57, 203)
c(14) = RGB(191, 187, 237)
c(15) = RGB(191, 187, 237)
'FORE COLOUR
c(16) = RGB(74, 62, 204)
ElseIf Theme = 6 Then
'BACK
c(0) = RGB(248, 242, 247)
c(1) = RGB(248, 242, 247)
c(2) = RGB(233, 211, 231)
c(3) = RGB(233, 211, 231)
'\
c(4) = RGB(226, 182, 222)
c(5) = RGB(226, 182, 222)
c(6) = RGB(239, 215, 237)
c(7) = RGB(239, 215, 237)
'FRONT
c(8) = RGB(251, 223, 249)
c(9) = RGB(251, 223, 249)
c(10) = RGB(239, 133, 230)
c(11) = RGB(239, 133, 230)
'\
c(12) = RGB(203, 57, 190)
c(13) = RGB(203, 57, 190)
c(14) = RGB(237, 187, 233)
c(15) = RGB(237, 187, 233)
'FORE COLOUR
c(16) = RGB(204, 62, 192)
ElseIf Theme = 7 Then
'BACK
c(0) = RGB(248, 242, 242)
c(1) = RGB(248, 242, 242)
c(2) = RGB(233, 211, 211)
c(3) = RGB(233, 211, 211)
'\
c(4) = RGB(226, 182, 182)
c(5) = RGB(226, 182, 182)
c(6) = RGB(239, 215, 215)
c(7) = RGB(239, 215, 215)
'FRONT
c(8) = RGB(251, 223, 223)
c(9) = RGB(251, 223, 223)
c(10) = RGB(239, 133, 133)
c(11) = RGB(239, 133, 133)
'\
c(12) = RGB(203, 57, 57)
c(13) = RGB(203, 57, 57)
c(14) = RGB(237, 187, 187)
c(15) = RGB(237, 187, 187)
'FORE COLOUR
c(16) = RGB(204, 62, 62)
ElseIf Theme = 8 Then
'BACK
c(0) = RGB(250, 253, 254)
c(1) = RGB(250, 253, 254)
c(2) = RGB(228, 243, 252)
c(3) = RGB(228, 243, 252)
'\
c(4) = RGB(199, 230, 249)
c(5) = RGB(199, 230, 249)
c(6) = RGB(237, 247, 253)
c(7) = RGB(237, 247, 253)
'FRONT
c(8) = RGB(225, 247, 255)
c(9) = RGB(225, 247, 255)
c(10) = RGB(67, 208, 255)
c(11) = RGB(67, 208, 255)
'\
c(12) = RGB(63, 112, 233)
c(13) = RGB(63, 112, 233)
c(14) = RGB(63, 226, 246)
c(15) = RGB(63, 226, 246)
'FORE COLOUR
c(16) = RGB(23, 139, 211)
ElseIf Theme = 9 Then
'BACK
c(0) = RGB(231, 243, 232)
c(1) = RGB(231, 243, 232)
c(2) = RGB(225, 219, 225)
c(3) = RGB(225, 219, 225)
'\
c(4) = RGB(179, 189, 179)
c(5) = RGB(179, 189, 179)
c(6) = RGB(226, 238, 226)
c(7) = RGB(226, 238, 226)
'FRONT
c(8) = RGB(223, 251, 223)
c(9) = RGB(223, 251, 223)
c(10) = RGB(108, 255, 108)
c(11) = RGB(108, 255, 108)
'\
c(12) = RGB(26, 228, 26)
c(13) = RGB(26, 228, 26)
c(14) = RGB(217, 244, 217)
c(15) = RGB(217, 244, 217)
'FORE COLOUR
c(16) = RGB(188, 184, 188)
ElseIf Theme = 10 Then
'BACK
c(0) = LightenColor(U_PBSCC2, 180)
c(1) = LightenColor(U_PBSCC2, 180)
c(2) = LightenColor(U_PBSCC2, 50)
c(3) = LightenColor(U_PBSCC2, 50)
'\
c(4) = U_PBSCC2
c(5) = U_PBSCC2
c(6) = LightenColor(U_PBSCC2, 80)
c(7) = LightenColor(U_PBSCC2, 80)
'FRONT
c(8) = LightenColor(U_PBSCC1, 180)
c(9) = LightenColor(U_PBSCC1, 180)
c(10) = LightenColor(U_PBSCC1, 50)
c(11) = LightenColor(U_PBSCC1, 50)
'\
c(12) = U_PBSCC1
c(13) = U_PBSCC1
c(14) = LightenColor(U_PBSCC1, 80)
c(15) = LightenColor(U_PBSCC1, 80)
'FORE COLOUR
c(16) = U_PBSCC1
End If
End Sub
Private Sub DrawCaptionText(ByVal TextString As String, ByVal Alignment As U_TextAlignments)
Dim lonStartWidth As Long, lonStartHeight As Long
Dim PBTCN, PBTCS As Long
If Enabled = True Then
PBTCN = U_TextColor
PBTCS = U_TextEC
Else
PBTCN = ColourTOGray(U_TextColor)
PBTCS = ColourTOGray(U_TextEC)
End If
UserControl.ForeColor = PBTCN
If Alignment = 1 Then
lonStartWidth = 1
lonStartHeight = 0
ElseIf Alignment = 2 Then
lonStartWidth = 1
lonStartHeight = (UserControl.ScaleHeight / 2) - (UserControl.TextHeight(TextString) / 2) - 1
ElseIf Alignment = 3 Then
lonStartWidth = 1
lonStartHeight = (UserControl.ScaleHeight - UserControl.TextHeight(TextString)) - 1
ElseIf Alignment = 4 Then
lonStartWidth = (UserControl.ScaleWidth / 2) - (UserControl.TextWidth(TextString) / 2) - 1
lonStartHeight = 0
ElseIf Alignment = 5 Then
lonStartWidth = (UserControl.ScaleWidth / 2) - (UserControl.TextWidth(TextString) / 2) - 1
lonStartHeight = (UserControl.ScaleHeight / 2) - (UserControl.TextHeight(TextString) / 2) - 1
ElseIf Alignment = 6 Then
lonStartWidth = (UserControl.ScaleWidth / 2) - (UserControl.TextWidth(TextString) / 2) - 1
lonStartHeight = (UserControl.ScaleHeight - UserControl.TextHeight(TextString)) - 1
ElseIf Alignment = 7 Then
lonStartWidth = (UserControl.ScaleWidth - UserControl.TextWidth(TextString)) - 3
lonStartHeight = 0
ElseIf Alignment = 8 Then
lonStartWidth = (UserControl.ScaleWidth - UserControl.TextWidth(TextString)) - 3
lonStartHeight = (UserControl.ScaleHeight / 2) - (UserControl.TextHeight(TextString) / 2) - 1
ElseIf Alignment = 9 Then
lonStartWidth = (UserControl.ScaleWidth - UserControl.TextWidth(TextString)) - 3
lonStartHeight = (UserControl.ScaleHeight - UserControl.TextHeight(TextString)) - 1
End If
If U_TextEffect = Normal Then
UserControl.CurrentX = lonStartWidth
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
ElseIf U_TextEffect = Engraved Then
UserControl.ForeColor = PBTCS
UserControl.CurrentX = lonStartWidth + 1
UserControl.CurrentY = lonStartHeight + 1
UserControl.Print TextString
UserControl.ForeColor = RGB(128, 128, 128)
UserControl.CurrentX = lonStartWidth - 1
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
UserControl.ForeColor = PBTCN
UserControl.CurrentX = lonStartWidth
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
ElseIf U_TextEffect = Embossed Then
UserControl.ForeColor = PBTCS
UserControl.CurrentX = lonStartWidth - 1
UserControl.CurrentY = lonStartHeight - 1
UserControl.Print TextString
UserControl.ForeColor = RGB(128, 128, 128)
UserControl.CurrentX = lonStartWidth + 1
UserControl.CurrentY = lonStartHeight + 1
UserControl.Print TextString
UserControl.ForeColor = PBTCN
UserControl.CurrentX = lonStartWidth
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
ElseIf U_TextEffect = OutLine Then
UserControl.ForeColor = PBTCS
UserControl.CurrentX = lonStartWidth + 1
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
UserControl.CurrentX = lonStartWidth - 1
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
UserControl.CurrentY = lonStartHeight - 1
UserControl.CurrentX = lonStartWidth
UserControl.Print TextString
UserControl.CurrentY = lonStartHeight + 1
UserControl.CurrentX = lonStartWidth
UserControl.Print TextString
UserControl.ForeColor = PBTCN
UserControl.CurrentX = lonStartWidth
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
ElseIf U_TextEffect = Shadow Then
UserControl.ForeColor = PBTCS
UserControl.CurrentX = lonStartWidth + 1
UserControl.CurrentY = lonStartHeight + 1
UserControl.Print TextString
UserControl.ForeColor = PBTCN
UserControl.CurrentX = lonStartWidth
UserControl.CurrentY = lonStartHeight
UserControl.Print TextString
End If
End Sub
Public Function DrawGradientFourColour(ObjectHDC As Long, Left As Long, Top As Long, Width As Long, Height As Long, TopLeftColour As Long, TopRightColour As Long, BottomLeftColour As Long, BottomRightColour As Long)
Dim bi24BitInfo As BITMAPINFO
Dim bBytes() As Byte
Dim LeftGrads() As cRGB
Dim RightGrads() As cRGB
Dim MiddleGrads() As cRGB
Dim TopLeft As cRGB
Dim TopRight As cRGB
Dim BottomLeft As cRGB
Dim BottomRight As cRGB
Dim iLoop As Long
Dim bytesWidth As Long
With TopLeft
.Red = Red(TopLeftColour)
.Green = Green(TopLeftColour)
.Blue = Blue(TopLeftColour)
End With
With TopRight
.Red = Red(TopRightColour)
.Green = Green(TopRightColour)
.Blue = Blue(TopRightColour)
End With
With BottomLeft
.Red = Red(BottomLeftColour)
.Green = Green(BottomLeftColour)
.Blue = Blue(BottomLeftColour)
End With
With BottomRight
.Red = Red(BottomRightColour)
.Green = Green(BottomRightColour)
.Blue = Blue(BottomRightColour)
End With
GradateColours LeftGrads, Height, TopLeft, BottomLeft
GradateColours RightGrads, Height, TopRight, BottomRight
With bi24BitInfo.bmiHeader
.biBitCount = 24
.biCompression = BI_RGB
.biPlanes = 1
.biSize = Len(bi24BitInfo.bmiHeader)
.biWidth = Width
.biHeight = 1
End With
ReDim bBytes(1 To bi24BitInfo.bmiHeader.biWidth * bi24BitInfo.bmiHeader.biHeight * 3) As Byte
bytesWidth = (Width) * 3
For iLoop = 0 To Height - 1
GradateColours MiddleGrads, Width, LeftGrads(iLoop), RightGrads(iLoop)
CopyMemory bBytes(1), MiddleGrads(0), bytesWidth
SetDIBitsToDevice ObjectHDC, Left, Top + iLoop, bi24BitInfo.bmiHeader.biWidth, bi24BitInfo.bmiHeader.biHeight, 0, 0, 0, bi24BitInfo.bmiHeader.biHeight, bBytes(1), bi24BitInfo, DIB_RGB_COLORS
Next iLoop
End Function
Private Function GradateColours(cResults() As cRGB, Length As Long, Colour1 As cRGB, Colour2 As cRGB)
Dim fromR As Integer
Dim toR As Integer
Dim fromG As Integer
Dim toG As Integer
Dim fromB As Integer
Dim toB As Integer
Dim stepR As Single
Dim stepG As Single
Dim stepB As Single
Dim iLoop As Long
ReDim cResults(0 To Length)
fromR = Colour1.Red
fromG = Colour1.Green
fromB = Colour1.Blue
toR = Colour2.Red
toG = Colour2.Green
toB = Colour2.Blue
stepR = Divide(toR - fromR, Length)
stepG = Divide(toG - fromG, Length)
stepB = Divide(toB - fromB, Length)
For iLoop = 0 To Length
cResults(iLoop).Red = fromR + (stepR * iLoop)
cResults(iLoop).Green = fromG + (stepG * iLoop)
cResults(iLoop).Blue = fromB + (stepB * iLoop)
Next iLoop
End Function
Private Function Blue(Colour As Long) As Long
Blue = (Colour And &HFF0000) / &H10000
End Function
Private Function Green(Colour As Long) As Long
Green = (Colour And &HFF00&) / &H100
End Function
Private Function Red(Colour As Long) As Long
Red = (Colour And &HFF&)
End Function
Private Function Divide(Numerator, Denominator) As Single
If Numerator = 0 Or Denominator = 0 Then
Divide = 0
Else
Divide = Numerator / Denominator
End If
End Function
Public Sub GradientTwoColour(ByVal hDC As Long, ByVal Direction As GRADIENT_DIRECT, ByVal StartColor As Long, ByVal EndColor As Long, Left As Long, Top As Long, Width As Long, Height As Long)
Dim udtVert(1) As TRIVERTEX, udtGRect As GRADIENT_RECT
Dim UDTRECT As RECT
'hDCObj.ScaleMode = vbPixels
'hDCObj.AutoRedraw = True
SetRect UDTRECT, Left, Top, Width, Height
With udtVert(0)
.X = UDTRECT.Left
.Y = UDTRECT.Top
.Red = LongToSignedShort(CLng((StartColor And &HFF&) * 256))
.Green = LongToSignedShort(CLng(((StartColor And &HFF00&) \ &H100&) * 256))
.Blue = LongToSignedShort(CLng(((StartColor And &HFF0000) \ &H10000) * 256))
.Alpha = 0&
End With
With udtVert(1)
.X = UDTRECT.Right
.Y = UDTRECT.Bottom
.Red = LongToSignedShort(CLng((EndColor And &HFF&) * 256))
.Green = LongToSignedShort(CLng(((EndColor And &HFF00&) \ &H100&) * 256))
.Blue = LongToSignedShort(CLng(((EndColor And &HFF0000) \ &H10000) * 256))
.Alpha = 0&
End With
udtGRect.UpperLeft = 0
udtGRect.LowerRight = 1
GradientFillRect hDC, udtVert(0), 2, udtGRect, 1, Direction
End Sub
Private Function LongToSignedShort(ByVal Unsigned As Long) As Integer
If Unsigned < 32768 Then
LongToSignedShort = CInt(Unsigned)
Else
LongToSignedShort = CInt(Unsigned - &H10000)
End If
End Function
Private Function ColourTOGray(ByVal uColor As Long) As Long
Dim Red As Long, Blue As Long, Green As Long
Dim gray As Long
Red = uColor Mod 256
Green = (uColor Mod 65536) / 256
Blue = uColor / 65536
gray = (Red + Green + Blue) / 3
ColourTOGray = RGB(gray, gray, gray)
End Function
Private Function LightenColor(ByVal uColour As ColorConstants, Optional ByVal OffSet As Long = 1) As Long
Dim intR As Integer, intG As Integer, intB As Integer
intR = Abs((uColour Mod 256) + OffSet)
intG = Abs((((uColour And &HFF00) / 256&) Mod 256&) + OffSet)
intB = Abs(((uColour And &HFF0000) / 65536) + OffSet)
LightenColor = RGB(intR, intG, intB)
End Function
Public Sub About()
Attribute About.VB_UserMemId = -552
FrmAbout.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -