clssysbusy.cls

来自「很好! 很实用! 免费!」· CLS 代码 · 共 78 行

CLS
78
字号
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsSysBusy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
Const HWND_TOPMOST = -1
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Private Declare Function SetWindowPos Lib "user32" _
         (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, _
          ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Function Show(Optional ByVal sCaption As String = "", Optional ByVal iShowType As vbBusy = vbBusySchedule, Optional ByVal iScheduleMax As Long = 0) As Boolean
  Dim lngWindowPosition As Long
  frmShowDialogBusy.iType = iShowType
  frmShowDialogBusy.Caption = sCaption
  frmShowDialogBusy.Show
  frmShowDialogBusy.Refresh
  
  lngWindowPosition = SetWindowPos(frmShowDialogBusy.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
  
  If iShowType = vbBusySchedule And iScheduleMax > 0 Then ScheduleMax = iScheduleMax
End Function
Public Function Hide() As Boolean
  frmShowDialogBusy.Hide
End Function
Public Function Dispose() As Boolean
  Unload frmShowDialogBusy
End Function
Public Property Get ScheduleMax() As Long
  ScheduleMax = frmShowDialogBusy.ScheduleBar1.Max
End Property
Public Property Let ScheduleMax(ByVal vData As Long)
  frmShowDialogBusy.ScheduleBar1.Max = vData
End Property
Public Property Get ScheduleMin() As Long
  ScheduleMin = frmShowDialogBusy.ScheduleBar1.Min
End Property
Public Property Let ScheduleMin(ByVal vData As Long)
  frmShowDialogBusy.ScheduleBar1.Min = vData
End Property
Public Property Get ScheduleValue() As Long
  ScheduleValue = frmShowDialogBusy.ScheduleBar1.value
End Property
Public Property Let ScheduleValue(ByVal vData As Long)
  If vData <= ScheduleMax And vData >= ScheduleMin Then
    frmShowDialogBusy.ScheduleBar1.value = vData
    'show in label
    frmShowDialogBusy.ScheduleLbl1.Caption = ScheduleMax & "--" & vData
  End If
End Property
Public Function ScheduleValueAdd(Optional ByVal iStep As Integer = 1) As Boolean
    DoEvents
    If frmShowDialogBusy.Visible = False Then
        ScheduleValueAdd = False
    Else
        ScheduleValue = ScheduleValue + iStep
        ScheduleValueAdd = True
    End If
End Function
Public Property Let Caption(ByVal sCaption As String)
  frmShowDialogBusy.Caption = sCaption
End Property
Public Property Get Caption() As String
  Caption = frmShowDialogBusy.Caption
End Property

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?