📄 taskbar.ctl
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.UserControl TaskBar
AutoRedraw = -1 'True
ClientHeight = 3600
ClientLeft = 0
ClientTop = 0
ClientWidth = 4800
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ScaleHeight = 240
ScaleMode = 3 'Pixel
ScaleWidth = 320
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 100
Left = 2400
Top = 3120
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H00FFFFFF&
BorderStyle = 0 'None
Height = 360
Left = 2700
ScaleHeight = 18
ScaleMode = 2 'Point
ScaleWidth = 18
TabIndex = 1
Top = 735
Visible = 0 'False
Width = 360
End
Begin MSComctlLib.ImageList ImageList1
Left = 2265
Top = 1590
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
MaskColor = 12632256
_Version = 393216
End
Begin Project1.TaskBarButton TaskBarButton1
Height = 360
Index = 0
Left = 60
TabIndex = 0
Top = 75
Width = 2475
_ExtentX = 4366
_ExtentY = 635
End
Begin Project1.EnumTasks EnumTasks1
Left = 1125
Top = 2280
_ExtentX = 1138
_ExtentY = 1032
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 100
Left = 3735
Top = 3090
End
End
Attribute VB_Name = "TaskBar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居汉化收藏整理
'发布日期:2006/11/10
'描 述:仿红帽子操作系统Shell
'网 站:http://www.Mndsoft.com/ (VB6源码博客)
'网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Private Declare Function DrawTextEx Lib "user32" Alias "DrawTextExA" (ByVal hdc As Long, ByVal lpsz As String, ByVal n As Long, lpRect As RECT, ByVal un As Long, lpDrawTextParams As DRAWTEXTPARAMS) As Long
Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Declare Function RedrawWindow Lib "user32" (ByVal hwnd As Long, lprcUpdate As RECT, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long
Private Const DT_BOTTOM = &H8
Private Const DT_CALCRECT = &H400
Private Const DT_LEFT = &H0
Private Const DT_CENTER = &H1
Private Const DT_RIGHT = &H2
Private Const DT_SINGLELINE = &H20
Private Const DT_TABSTOP = &H80
Private Const DT_TOP = &H0
Const RDW_INVALIDATE = &H1
Private Const DT_VCENTER = &H4
Private Const DT_WORDBREAK = &H10
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type DRAWTEXTPARAMS
cbSize As Long
iTabLength As Long
iLeftMargin As Long
iRightMargin As Long
uiLengthDrawn As Long
End Type
'15132390
Private Const Color_Cap = "53,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329"
Private Const Color_Cent_1 = "53,10066329,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,10066329"
Private Const Color_Filled = "53,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,10066329,-1,-1"
Private Const Color_Cent_2 = "53,8947848,14606046,12829635,10855845,9342606,8553090,8289918,8026746,7763574,7434609,7303023,6974058,6776679,6513507,6250335,6052956,6052956,6052956,5855577,5658198,5526612,5395026,5263440,5131854,5131854,5131854,5131854,5197647,5395026,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612,5526612"
Private Color_Cent As String
Private LastButtonLeft As Integer
Private CurrentButtonOver As Integer
Public fClassList As New Collection
Public fClassButton As New Collection
Public Event ButtonClicked(Index As Integer, Button As Integer)
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Type Buttons_
Left As Integer
Top As Integer
Count As Integer
MaxWidth As Integer
BarWidth As Integer
MODcount As Integer
hwnd As Variant
End Type
Public TaskBarColor
Dim Buttons As Buttons_
Dim hold_Style As Style_
Public Property Get Style() As Style_
Style = hold_Style
TaskBarButton1(0).Style = hold_Style
LoadGUI
End Property
Public Property Let Style(strStyle As Style_)
hold_Style = strStyle
TaskBarButton1(0).Style = strStyle
LoadGUI
End Property
Function Repaint()
EmptyButtonBin
LoadTasks
Dim x As Integer
For x = 0 To fClassList.Count - 1
RepaintIcon x
Next
End Function
Function RipPicture(TransColor As ColorConstants) As String
Dim i As Integer
Dim j As Integer
Dim Temp As String
Temp = Temp & Picture1.ScaleHeight - 1 & ","
Do Until i >= Picture1.ScaleWidth
j = 0
Do Until j >= Picture1.ScaleHeight
DoEvents
Dim CurrColor As Long
CurrColor = GetPixel(Picture1.hdc, i, j)
If CurrColor = TransColor Then CurrColor = -1
Temp = Temp & CurrColor & ","
j = j + 1
Loop
i = i + 1
Loop
Temp = Left(Temp, LenB(StrConv(Temp, vbFromUnicode)) - 1) 'Len(Temp)
RipPicture = Temp
End Function
Private Function LoadBmpMenuLines(Legnth As Integer, ColorPallet As String, x As Integer, y As Integer, Optional Gray As Boolean = True, Optional Brightness As Integer) As Integer
Dim PixCount
Dim Colors() As String, CurrentRow, CurrentColumn, Count, Rows
Colors = Split(ColorPallet, ",")
Rows = Int(Split(ColorPallet, ",")(0))
For Count = 1 To UBound(Colors)
If CurrentRow > (Rows) Then CurrentRow = 0: CurrentColumn = CurrentColumn + 1
If Colors(Count) <> -1 Then
If Colors(Count) = -2 Then Colors(Count) = TaskBarColor
If Gray = True Then
UserControl.Line (x + CurrentColumn, y + CurrentRow)-(x + CurrentColumn + Legnth, y + CurrentRow), AdjustBrightness(Colors(Count), Brightness)
Else
UserControl.Line (x + CurrentColumn, y + CurrentRow)-(x + CurrentColumn + Legnth, y + CurrentRow), MakeGrey(Colors(Count))
End If
End If
CurrentRow = CurrentRow + 1
Next
LoadBmpMenuLines = CurrentColumn
End Function
Function LoadGUI()
Select Case hold_Style
Case Red_Hat
Color_Cent = Color_Cent_1
Case Longhorn
Color_Cent = Color_Cent_2
End Select
TaskBarColor = 15132390
LoadBmpMenuLines 1, Color_Cap, 0, 0
LoadBmpMenuLines UserControl.ScaleWidth - 2, Color_Cent, 1, 0
LoadBmpMenuLines 1, Color_Cap, UserControl.ScaleWidth - 1, 0
UserControl.Height = 54 * 15
End Function
Private Sub Timer1_Timer()
With UserControl
LoadBmpMenuLines 99, Color_Cent, UserControl.ScaleWidth - 100, 0
Dim htext As String
Dim lentext As Long
Dim vh As Integer
Dim hRect As RECT
htext = FormatDateTime(Date, vbLongDate) & vbNewLine & Time
lentext = LenB(StrConv(htext, vbFromUnicode)) 'Len(htext)
SetRect hRect, 4, 0, .ScaleWidth - 4, .ScaleHeight
vh = DrawText(.hdc, htext, lentext, hRect, DT_CALCRECT Or DT_CENTER Or DT_WORDBREAK)
SetRect hRect, 4, (.ScaleHeight * 0.5) - (vh * 0.5), .ScaleWidth - 4, (.ScaleHeight * 0.5) + (vh * 0.5)
DrawText .hdc, htext, lentext, hRect, DT_RIGHT Or DT_WORDBREAK
.Refresh
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -