⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.frm

📁 功能界面漂亮的带宽使用量监视器
💻 FRM
📖 第 1 页 / 共 3 页
字号:
Me.Icon = ImageList2.ListImages(2).Picture
Image1.Picture = ImageList2.ListImages(2).Picture
ElseIf blnIsRecv And (Not blnIsSent) Then
Pic1.Picture = ImageList2.ListImages(3).Picture
Me.Icon = ImageList2.ListImages(3).Picture
Image1.Picture = ImageList2.ListImages(3).Picture
ElseIf Not (blnIsRecv And blnIsSent) Then
Pic1.Picture = ImageList2.ListImages(1).Picture
Me.Icon = ImageList2.ListImages(1).Picture
Image1.Picture = ImageList2.ListImages(1).Picture
End If
End If

If IconToUse = "icon3" Then
If blnIsRecv And blnIsSent Then
Pic1.Picture = ImageList3.ListImages(4).Picture
Me.Icon = ImageList3.ListImages(4).Picture
Image1.Picture = ImageList3.ListImages(4).Picture
ElseIf (Not blnIsRecv) And blnIsSent Then
Pic1.Picture = ImageList3.ListImages(2).Picture
Me.Icon = ImageList3.ListImages(2).Picture
Image1.Picture = ImageList3.ListImages(2).Picture
ElseIf blnIsRecv And (Not blnIsSent) Then
Pic1.Picture = ImageList3.ListImages(3).Picture
Me.Icon = ImageList3.ListImages(3).Picture
Image1.Picture = ImageList3.ListImages(3).Picture
ElseIf Not (blnIsRecv And blnIsSent) Then
Pic1.Picture = ImageList3.ListImages(1).Picture
Me.Icon = ImageList3.ListImages(1).Picture
Image1.Picture = ImageList3.ListImages(1).Picture
End If
End If

If IconToUse = "icon4" Then
If blnIsRecv And blnIsSent Then
Pic1.Picture = ImageList4.ListImages(4).Picture
Me.Icon = ImageList4.ListImages(4).Picture
Image1.Picture = ImageList4.ListImages(4).Picture
ElseIf (Not blnIsRecv) And blnIsSent Then
Pic1.Picture = ImageList4.ListImages(2).Picture
Me.Icon = ImageList4.ListImages(2).Picture
Image1.Picture = ImageList4.ListImages(2).Picture
ElseIf blnIsRecv And (Not blnIsSent) Then
Pic1.Picture = ImageList4.ListImages(3).Picture
Me.Icon = ImageList4.ListImages(3).Picture
Image1.Picture = ImageList4.ListImages(3).Picture
ElseIf Not (blnIsRecv And blnIsSent) Then
Pic1.Picture = ImageList4.ListImages(1).Picture
Me.Icon = ImageList4.ListImages(1).Picture
Image1.Picture = ImageList4.ListImages(1).Picture
End If
End If

If IconToUse = "icon5" Then
If blnIsRecv And blnIsSent Then
Pic1.Picture = ImageList5.ListImages(4).Picture
Me.Icon = ImageList5.ListImages(4).Picture
Image1.Picture = ImageList5.ListImages(4).Picture
ElseIf (Not blnIsRecv) And blnIsSent Then
Pic1.Picture = ImageList5.ListImages(2).Picture
Me.Icon = ImageList5.ListImages(2).Picture
Image1.Picture = ImageList5.ListImages(2).Picture
ElseIf blnIsRecv And (Not blnIsSent) Then
Pic1.Picture = ImageList5.ListImages(3).Picture
Me.Icon = ImageList5.ListImages(3).Picture
Image1.Picture = ImageList5.ListImages(3).Picture
ElseIf Not (blnIsRecv And blnIsSent) Then
Pic1.Picture = ImageList5.ListImages(1).Picture
Me.Icon = ImageList5.ListImages(1).Picture
Image1.Picture = ImageList5.ListImages(1).Picture
End If
End If

ModifyIcon
lngBytesRecv = m_objIpHelper.BytesReceived
lngBytesSent = m_objIpHelper.BytesSent
DoEvents

End Sub

Private Sub Timer2_Timer()

On Error Resume Next
DoEvents
Dim XX As Long
Dim YY As Long
Dim XXX As Long
Dim YYY As Long
YYY = Label6.Caption
YY = Label5.Caption
DoEvents
XX = Me.lblRecv.Caption - YY
XXX = Me.lblSent.Caption - YYY
DoEvents
TransferRate = Format(Int(XX), "00.00")
DoEvents
TransferRate2 = Format(Int(XXX), "00.00")
DoEvents

                Label10.Caption = TransferRate2 & " KB"
                DoEvents

                Label9.Caption = TransferRate & " KB"
                DoEvents
    DoEvents
    Label5.Caption = Me.lblRecv.Caption
    Label6.Caption = Me.lblSent.Caption
    DoEvents

End Sub
Public Sub DragForm(Frm As Form)

On Local Error Resume Next

'Move the borderless form...
Call ReleaseCapture
Call SendMessage(Frm.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)

End Sub

Private Sub btnBottomDown_Click(Index As Integer)
FrmStats.WindowState = 0
    ' only do this if we are slid out
    If bBottomOut = True Then
        ' reset the target offest ...
        iRelBottomTrayOffset = FrmMain.Top
        ' and reel her in
        Do While FrmStats.Top > iRelBottomTrayOffset
            ' in two pixels
            FrmStats.Top = FrmStats.Top - 30
            ' and make sure the main form stays on top
            FrmMain.ZOrder
            DoEvents
        Loop
        ' now hide the tray and set the bBottomOut flag false to allow sliding down
        FrmStats.Hide
        bBottomOut = False
        Exit Sub
    End If
    DoEvents
    ' don't do anything if it's already slid down
    If bBottomOut = True Then Exit Sub
    ' postition the tray ready to slide down
    FrmStats.Left = FrmMain.Left ' + 150
    FrmStats.Top = FrmMain.Top
    FrmStats.Show
    Me.SetFocus
    DoEvents
    iRelBottomTrayOffset = FrmMain.Top + FrmMain.Height ' - 75
    'Do Until FrmStats.Height >= 4485
    'FrmStats.Height = FrmStats.Height + 15
    'Loop
    Do While FrmStats.Top < iRelBottomTrayOffset
        'down 1 more pixel
        FrmStats.Top = FrmStats.Top + 15
        ' make sure the main form stays on top
        FrmMain.ZOrder
        DoEvents
    Loop
    FrmStats.Top = FrmMain.Top + FrmMain.Height
    bBottomOut = True
    
    
End Sub

Private Sub Form_Load()
If App.PrevInstance = True Then
End
End If
DoEvents

Dim CheckMainOnTop As String
CheckMainOnTop = ReadINI("settings", "mainontop", App.Path & "\settings.ini")

If CheckMainOnTop = "unchecked" Then
MainOnTop = False
End If
If CheckMainOnTop = "checked" Then
MainOnTop = True
End If

Set m_objIpHelper = New CIpHelper

bBottomOut = False

Me.Height = 2745
Me.Width = 4560

IconToUse = ReadINI("settings", "icon", App.Path & "\settings.ini")

Me.Top = Val(ReadINI("formposition", "maintop", QuickRef.UserINIFileName))
Me.Left = Val(ReadINI("formposition", "mainleft", QuickRef.UserINIFileName))

Me.Caption = "CS Bandwidth Monitor v" & App.Major & "." & App.Minor & "." & App.Revision & " Beta 2"
lblCaption.Caption = "CS Bandwidth Monitor v" & App.Major & "." & App.Minor & "." & App.Revision & " Beta 2"

Call LoadColors
Call SetColors(Me)

SysTray
DoEvents
If ReadINI("settings", "showmainform", App.Path & "\settings.ini") = "unchecked" Then
Timer3.Enabled = True
End If

If ReadINI("settings", "showdesktopform", App.Path & "\settings.ini") = "checked" Then
FrmDesktop.Show
End If

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

btnBottomDown(1).Picture = btnBottomDown(0).Picture
'Move the form if the user is pressing and holding the mouse button...
If Button = vbLeftButton Then
    Call DragForm(Me)
    If bBottomOut = True Then
        FrmStats.Left = FrmMain.Left
        FrmStats.Top = FrmMain.Top + FrmMain.Height
    End If
Call WriteINI("formposition", "maintop", Me.Top, App.Path & "\settings.ini")
Call WriteINI("formposition", "mainleft", Me.Left, App.Path & "\settings.ini")
End If


End Sub

Private Sub Form_Resize()
If FrmStats.WindowState = vbMinimized Then
FrmStats.WindowState = 0
End If
End Sub

Private Sub Image3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
    Image3.Picture = Image4.Picture
End If
End Sub

Private Sub Image3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
    Image3.Picture = Image7.Picture
End If
End Sub

Private Sub imgClose_Click()
Unload Me
End Sub

Private Sub imgClose_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbLeftButton Then
    imgClose.Picture = Image5.Picture
End If

End Sub
Private Sub imgClose_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbLeftButton Then
    imgClose.Picture = Image8.Picture
End If

End Sub
Private Sub imgMinimize_Click()
On Error Resume Next
Me.WindowState = vbMinimized
FrmStats.WindowState = vbMinimized
End Sub

Private Sub imgMinimize_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbLeftButton Then
    imgMinimize.Picture = Image6.Picture
End If

End Sub
Private Sub imgMinimize_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbLeftButton Then
    imgMinimize.Picture = Image9.Picture
End If

End Sub

Private Sub Label11_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
    Image3.Picture = Image4.Picture
End If
End Sub

Private Sub Label11_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
    Image3.Picture = Image7.Picture
End If
End Sub
Private Sub Label12_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
    Image2.Picture = Image4.Picture
End If
End Sub

Private Sub Label12_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
    Image2.Picture = Image7.Picture
End If
End Sub
Private Sub Image2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
    Image2.Picture = Image4.Picture
End If
End Sub

Private Sub Image2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
    Image2.Picture = Image7.Picture
End If
End Sub

Private Sub lblCaption_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
btnBottomDown(1).Picture = btnBottomDown(0).Picture
'Move the form if the user is pressing and holding the mouse button...
If Button = vbLeftButton Then
    Call DragForm(Me)
    If bBottomOut = True Then
        FrmStats.Left = FrmMain.Left
        FrmStats.Top = FrmMain.Top + FrmMain.Height
    End If
End If

End Sub
Private Sub btnBottomDown_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    ' hilite the little green down arrow and unhilite the up arrow by swapping pics
    btnBottomDown(1).Picture = btnBottomDown(2).Picture
    'btnBottomUp(0) = btnBottomUp(1)
End Sub
Public Function SysTray()
TheForm.cbSize = Len(TheForm)
    
    TheForm.mhWnd = Pic1.hwnd
    TheForm.hIcon = Pic1.Picture
    TheForm.uId = 1&
    
    TheForm.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
    
    TheForm.ucallbackMessage = WM_MOUSEMOVE
    
TheForm.szTip = "CS Bandwidth Monitor v" & App.Major & "." & App.Minor & "." & App.Revision
    
    Shell_NotifyIcon NIM_ADD, TheForm
End Function
Function ModifyIcon()
TheForm.cbSize = Len(TheForm)
    
    TheForm.mhWnd = Pic1.hwnd
    TheForm.hIcon = Pic1.Picture
    TheForm.uId = 1&
    
    TheForm.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
    
    TheForm.ucallbackMessage = WM_MOUSEMOVE
    
    Shell_NotifyIcon NIM_MODIFY, TheForm
End Function
Public Sub CleanUpSystray()
Shell_NotifyIcon NIM_DELETE, TheForm
End Sub

Private Sub Timer3_Timer()
Me.Hide
Timer3.Enabled = False
End Sub

⌨️ 快捷键说明

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