📄 xp_statusbar.ctl
字号:
VERSION 5.00
Begin VB.UserControl XP_StatusBar
Alignable = -1 'True
AutoRedraw = -1 'True
ClientHeight = 420
ClientLeft = 0
ClientTop = 0
ClientWidth = 5940
ControlContainer= -1 'True
FillStyle = 0 'Solid
PropertyPages = "XP_StatusBar.ctx":0000
ScaleHeight = 28
ScaleMode = 3 'Pixel
ScaleWidth = 396
ToolboxBitmap = "XP_StatusBar.ctx":003F
End
Attribute VB_Name = "XP_StatusBar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'
' ucVeryWellsStatusBarXP.ctl V. 1.2b
'
' Origin: xpWellsStatusBar by Richard Wells
' Redesign and extensions: Light Templer (Reach me on GMX : schwepps_bitterlemon@gmx.de)
'
' Addition on 26.5.2003 MICK-S makes an update to XPwellsStatusBar. He added the Office XP apperance and the
' UseWindowsColors property. I put it into VeryWellsStatusBarXP to have a All-In-One solution.
' Examples updated to show most of the feautures.
'
' Special thanx to: Keith 'LaVolpe' Fox for the API timer code.
' Steve 'vbAaccelerator' McMahon for details on icons and lots of stuff.
' Carlos 'mztools' Quintero for his great freeware VB addin.
'
' Last changes by LT 1.6.2003
'
' Historie: 1.6.2003 * MEZ Fixed a bug in UserControl_Click()/UserControl_DblClick() handling
' events on disabled panels. Thx to 'Dream' !
' 2.6.2003 * Some improvements to draw_gradient().
' * Added "Public Sub ClearPanel(lPanelIndex As Long)" to erase the text
' on a panel without a total redraw. Used it immediatly for PanelCaption.
' This shortens the time for the API timer event very much!
' 3.6.2003 * Three new panel types (to be 'complete' ;)) : NUMLOCK, SCROLL, CAPSLOCK
' (Does anybody really use this ?)
' * Tags for panels included.
'
' 3.6.2003 * Changed the Read/Write property strategy. This speeds things up and should solve
' the problems some people have.
' * Two brand new styles (Appearance): XP Diagonal Left + Right ! A tribute to
' the 'LaVolpe-Button' Keith Fox wrote. Now you can use the diagonal styled buttons
' on a diagonal styled statusbar!
' * Changed revision to 1.1
'
' 4.6.2003 * Adds to panels: Visible and MinWidth property. DemoForm changed to show this.
'
' 5.6.2003 * 'Bold'-Fontstyle for panels captions and background pictures for the statusbar!
' (Now e can do things like skinning ... ). Some bug-fixes, finetuning and removing
' of no more used code (less is more ;) )
'
' 27.6.2003 * Thx to Andy: Bug fixed in 'LaVolpe-Style' with Type=Time (a fast ClearPanel error)
' Changed RECT and POINTAPI to API_RECT and API_POINT (easier to create OCX)
'
Option Explicit
' *******************************
' * EVENTS *
' *******************************
Public Event MouseDownInPanel(iPanel As Long)
Public Event Click(iPanelNumber)
Public Event DblClick(iPanelNumber)
Public Event TimerBeforeRedraw()
Public Event TimerAfterRedraw()
Public Event BeforeRedraw()
Public Event AfterRedraw()
' *************************************
' * PUBLIC ENUMS *
' *************************************
Public Enum enVWsbXPApperance ' "Apperance" is a too common name for a public var, so I added some unique stuff.
[Office XP] = 0
[Windows XP] = 1
[Simple] = 2
[XP Diagonal Left] = 3
[XP Diagonal Right] = 4
End Enum
' *************************************
' * PRIVATE CONSTS (DEFAULTS) *
' *************************************
Private Const m_def_UseWindowsColors = False
Private Const m_def_Apperance = [Windows XP]
Private Const constFORMAT_DATE = "yyyy.m.d" ' Adjust to your needs !
Private Const constFORMAT_TIME = "hh:nn:ss"
' *************************************
' * PRIVATE TYPE *
' *************************************
Private Type BITMAP '14 bytes
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
' *************************************
' * API DEFINITIONS *
' *************************************
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function CreateRectRgnIndirect Lib "gdi32" _
(lpRect As API_RECT) As Long
Private Declare Function PtInRegion Lib "gdi32" _
(ByVal hRgn As Long, _
ByVal X As Long, _
ByVal Y As Long) As Long
Private Declare Function OffsetRect Lib "user32" _
(lpRect As API_RECT, _
ByVal X As Long, _
ByVal Y As Long) As Long
Private Declare Function CopyRect Lib "user32" _
(lpDestRect As API_RECT, _
lpSourceRect As API_RECT) As Long
Private Declare Function StretchBlt Lib "gdi32" _
(ByVal hdc As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal nSrcWidth As Long, _
ByVal nSrcHeight As Long, _
ByVal dwRop As Long) As Long
Private Declare Function SetProp Lib "user32" Alias "SetPropA" _
(ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal hData As Long) As Long
Private Declare Function SetTimer Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long) As Long
Private Declare Function DrawEdge Lib "user32" _
(ByVal hdc As Long, _
qrc As API_RECT, _
ByVal edge As Long, _
ByVal grfFlags As Long) As Long
Private Declare Function InflateRect Lib "user32" _
(lpRect As API_RECT, _
ByVal X As Long, _
ByVal Y As Long) As Long
Private Declare Function GetSysColor Lib "user32" _
(ByVal nIndex As Long) As Long
Private Declare Function BitBlt Lib "gdi32" _
(ByVal hDestDC As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal dwRop As Long) As Long
Private Declare Function SetBkColor Lib "gdi32" _
(ByVal hdc As Long, _
ByVal crColor As Long) As Long
Private Declare Function GetBkColor Lib "gdi32" _
(ByVal hdc As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" _
(ByVal hdc As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" _
(ByVal hdc As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long) As Long
Private Declare Function GetObj Lib "gdi32" Alias "GetObjectA" _
(ByVal hObject As Long, _
ByVal nCount As Long, _
lpObject As Any) As Long
Private Declare Function GetDC Lib "user32" _
(ByVal hwnd As Long) As Long
Private Declare Function CreateBitmap Lib "gdi32" _
(ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal nPlanes As Long, _
ByVal nBitCount As Long, _
lpBits As Any) As Long
Private Declare Function SelectPalette Lib "gdi32" _
(ByVal hdc As Long, _
ByVal hPalette As Long, _
ByVal bForceBackground As Long) As Long
Private Declare Function RealizePalette Lib "gdi32" _
(ByVal hdc As Long) As Long
Private Declare Function ReleaseDC Lib "user32" _
(ByVal hwnd As Long, _
ByVal hdc As Long) As Long
Private Declare Function CreateHalftonePalette Lib "gdi32" _
(ByVal hdc As Long) As Long
Private Declare Function GetClientRect Lib "user32" _
(ByVal hwnd As Long, _
lpRect As API_RECT) As Long
Private Declare Function SetTextColor Lib "gdi32" _
(ByVal hdc As Long, _
ByVal crColor As Long) As Long
Private Declare Function GetTextColor Lib "gdi32" _
(ByVal hdc 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 API_RECT, _
ByVal wFormat As Long) As Long
Private Declare Function SetPixel Lib "gdi32" Alias "SetPixelV" _
(ByVal hdc As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal crColor As Long) As Long
Private Declare Function GetKeyboardState Lib "user32" _
(kbArray As KeyboardBytes) As Long
' *************************************
' * API CONSTANTS *
' *************************************
' For DrawText
Private Const DT_CALCRECT = &H400
Private Const DT_WORDBREAK = &H10
' Win32 edge draw consts
Private Const BF_BOTTOM = &H8
Private Const BF_RIGHT = &H4
Private Const BF_BOTTOMRIGHT = (BF_BOTTOM Or BF_RIGHT)
Private Const BF_TOP = &H2
Private Const BF_LEFT = &H1
Private Const BF_TOPLEFT = (BF_TOP Or BF_LEFT)
' Win32 Special color values
Private Const COLOR_BTNSHADOW = 16
Private Const COLOR_BTNHIGHLIGHT = 20
' Raster Operation Codes
Private Const DSna = &H220326 ' 0x00220326
Private Const ScrCopy = &HCC0020
' Misc
Private Const VK_CAPITAL = &H14
Private Const VK_NUMLOCK = &H90
Private Const VK_SCROLL = &H91
Private Const vbGray = 8421504
' *************************************
' * PRIVATES *
' *************************************
Private Type KeyboardBytes
kbByte(0 To 255) As Byte
End Type
Private kbArray As KeyboardBytes
' Gripper Stuff
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTBOTTOMRIGHT = 17
Private bDrawGripper As Boolean
Private frm As Form
Private WithEvents eForm As Form
Attribute eForm.VB_VarHelpID = -1
Private rcGripper As API_RECT
Private bDrawSeperators As Boolean
Private m_TopLine As Boolean
' Panel Stuff.
Private m_Panels() As New clsPanels
Private m_PanelCount As Long
Private rcPanel() As API_RECT
' Used for Click and DblClick Events
Private PanelNum As Long
' Panel colors and global mask color.
Private oBackColor As OLE_COLOR
Private oForeColor As OLE_COLOR
Private oMaskColor As OLE_COLOR
Private oDissColor As OLE_COLOR
' Misc stuff
Private flgTimerEnabled As Boolean
Private m_UseWindowsColors As Boolean
Private m_Apperance As enVWsbXPApperance
Private m_BackgroundPic As StdPicture
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -