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

📄 mainpage.frm

📁 用vb实现在线考试系统
💻 FRM
📖 第 1 页 / 共 5 页
字号:
                iNext = 0
'
        Case "NINESHOW"             ' 9 画面
               
                Show9Windows
                bswitch = 9
                Num = 9
                iNext = 0
'
        Case "SIXTEENSHOW"             ' 9 画面
              
                Show16Windows
                bswitch = 16
                Num = 16
                iNext = 0
'
        Case "SWITCHSHOW"
                
                 LargeWindow 1
                 
                 Switch1.Interval = SwitchInterval * 1000
                 Switch1.Enabled = True
                
                 tbrShowControl.Buttons.Item(1).Enabled = False
                 tbrShowControl.Buttons.Item(2).Enabled = False
                 tbrShowControl.Buttons.Item(3).Enabled = False
                 tbrShowControl.Buttons.Item(4).Enabled = False
            
        Case "STOPSWITCH"
                 
                 If Switch1.Enabled = True Then
                    Switch1.Enabled = False
                    
                 End If
                   Show16Windows
                  
                   tbrShowControl.Buttons.Item(1).Enabled = True
                   tbrShowControl.Buttons.Item(2).Enabled = True
                   tbrShowControl.Buttons.Item(3).Enabled = True
                   tbrShowControl.Buttons.Item(4).Enabled = True
                   tbrShowControl.Buttons.Item(5).key = ""
                Label3.Caption = ""
                    
        Case "PreviousPage"
                 
                   If iNext = 0 Then
                      tbrShowControl.Buttons.Item(7).Enabled = False
                   End If
                   
                   If bswitch = 1 Then
                   
                       If iNext > 1 Then
                          iNext = iNext - 1
                       End If
                       If iNext < 0 Then
                          iNext = 0
                       End If
    '                    Label5.Caption = "页码" & iNext
                       LargeWindow iNext
               
                   End If
                
                   If bswitch = 4 Then
                       For i = 0 To 3
                           
'                           record
                           Cli_Stop stockhandle(i + iNext * 4)
                       
                       Next i
                        
                       iNext = iNext - 1
                        
                       If iNext <= 0 Then
                          iNext = 3
                       End If

'                     Label5.Caption = "页码" & iNext
                       For i = 0 To 3
                           stockhandle(i + iNext * 4) = Cli_PlaySoft(PicVideo(i).hwnd, Channel(i + iNext * 4, 1), m_linktype, Channel(i + iNext * 4, 0), UserName, UserPassword, 1)
                       Next i
                   
                   End If
                    
                    
        Case "NextPage"
                  
                   tbrShowControl.Buttons.Item(7).Enabled = True
                   
                   If bswitch = 1 Then
                   
                   
                   iNext = iNext + 1
        
                   If iNext >= 16 Then
                      iNext = 1
                   End If
'                    Label5.Caption = "页码" & iNext
                   LargeWindow iNext
               
                   End If
                   
                   
                   If bswitch = 4 Then
                     For i = 0 To 3
                         
'                         record
                         Cli_Stop stockhandle(i + iNext * 4)
                     
                     Next i
                     gDelay 500
                     
                     iNext = iNext + 1
                    
                     If iNext > 3 Then
                      iNext = 0
                     End If
                     
'                     Label5.Caption = "页码" & iNext
                     For i = 0 To 3
                        stockhandle(i + iNext * 4) = Cli_PlaySoft(PicVideo(i).hwnd, Channel(i + iNext * 4, 1), m_linktype, Channel(i + iNext * 4, 0), UserName, UserPassword, 1)
                     Next i
                   
                   End If
        End Select
End Sub


' 选择单画面显示对象
Private Sub tbrShowControl_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
        Dim i As Integer
        
        For i = 1 To Max_Slots
            If ButtonMenu.key = "V" & i Then
                LargeWindow i
                Exit For
            End If
        Next i
End Sub

' 放大指定窗体
Public Sub LargeWindow(ByVal iChNo As Integer)

        Dim i As Integer
        
        PicVideo(iChNo - 1).left = Shift_L
        PicVideo(iChNo - 1).top = Shift_T
        PicVideo(iChNo - 1).Width = L_W
        PicVideo(iChNo - 1).Height = L_H
        
       ' If gStatusOfVideo(iChNo) = STATUS_VideoWrong Then
        '如果是视频出错状态,则加载最大化显示出错的JPG图片
           ' PicTmp.Picture = LoadPicture(gGetAppPath & "Err.Jpg")
           ' PicVideo(iChNo - 1).PaintPicture PicTmp.Picture, 0, 0, PicVideo(iChNo - 1).ScaleWidth, PicVideo(iChNo - 1).ScaleHeight
           ' PicTmp.Picture = LoadPicture("")
       ' Else
        ' 视频正常,则重新设定视频显示区域,即占满调整后的图片框区域
           ' Cli_SetVideoRect iChNo - 1, 0, 0, PicVideo(iChNo - 1).ScaleHeight + 2, PicVideo(iChNo - 1).ScaleWidth + 2
           ' gDelay DelayTime
        'End If
        
        PicVideo(iChNo - 1).ZOrder
        
        bHaveLargeWindow = True
End Sub

' 显示4画面
Private Sub Show1Windows()
        'Dim i As Integer
        'For i = 1 To 4
            SetPositionOfSlot 0, 0, 1 'i - 1, i - 1, 4
'            gDelay 1200
        'Next i
End Sub
' 显示4画面
Public Sub Show4Windows()
        Dim i As Integer
        For i = 1 To 4
            SetPositionOfSlot i - 1, i - 1, 4
'            gDelay 1200
        Next i
End Sub

' 显示9画面
Public Sub Show9Windows()
        Dim i As Integer
        For i = 1 To 9
            SetPositionOfSlot i - 1, i - 1, 9
'
        Next i
End Sub

' 显示16画面
Public Sub Show16Windows()
        Dim i As Integer
        For i = 1 To 16
            SetPositionOfSlot i - 1, i - 1, 16
'            gDelay 100
        Next i
End Sub

' 定位显示指定窗体,编号从0开始,nStyle为1、4、9,16
Private Sub SetPositionOfSlot(ByVal nWhere As Integer, ByVal nSlotNo As Integer, ByVal nStyle As Integer)
        Dim iC As Integer, iW As Integer, iH As Integer
        
        If nStyle = 1 Then
            iC = 1
        ElseIf nStyle = 4 Then
            iC = 2
        ElseIf nStyle = 9 Then
            iC = 3
        Else
            iC = 4
        End If
        
        iW = (L_W \ iC)
        iH = (L_H \ iC)
        
        PicVideo(nSlotNo).left = (nWhere Mod iC) * iW + Shift_L
        PicVideo(nSlotNo).top = (nWhere \ iC) * iH + Shift_T
        PicVideo(nSlotNo).Width = iW
        PicVideo(nSlotNo).Height = iH
        PicVideo(nSlotNo).ZOrder
       ' If nSlotNo < 64 Then
            'If gStatusOfVideo(nSlotNo + 1) = STATUS_VideoWrong Then
              ' PicTmp.Picture = LoadPicture(gGetAppPath & "err.JPG")
              ' PicVideo(nSlotNo).PaintPicture PicTmp.Picture, 0, 0, PicVideo(nSlotNo).ScaleWidth, PicVideo(nSlotNo).ScaleHeight
              ' PicTmp.Picture = LoadPicture("")
           ' Else
               ' Cli_SetVideoRect nSlotNo, 0, 0, PicVideo(nSlotNo).ScaleHeight + 2, PicVideo(nSlotNo).ScaleWidth + 2
           ' End If
               
       ' End If
End Sub

Private Sub picVideo_DblClick(Index As Integer)
        If flag10 = False Then
               flag10 = True
               LargeWindow Index + 1
        Else
                flag10 = False
                
                If Num = 4 Then
                   Show4Windows
                ElseIf Num = 9 Then
                   Show9Windows
                Else
                  Show16Windows
                End If
        End If
End Sub

' 显示状态
Private Sub ShowStatusOfSlots()
        Dim i As Integer
        Dim iStatus As Integer
        Dim sStatusFile As String
        
        For i = 1 To 64
            sStatusFile = gGetIniPath & "StatusOf" & i & ".Ini"
            If Dir(sStatusFile) <> "" Then
                '读ini文件
                iStatus = GetPrivateProfileInt("Setup", "Status", STATUS_VideoWrong, sStatusFile)
                ' 改变相应图标
                Select Case iStatus
                Case STATUS_VideoWrong
                    If gStatusOfVideo(i) <> STATUS_VideoWrong Then
                        
                       ' PicTmp.Picture = LoadPicture(gGetAppPath & "Err.Jpg")
                       ' PicVideo(i - 1).PaintPicture PicTmp.Picture, 0, 0, PicVideo(i - 1).ScaleWidth, PicVideo(i - 1).ScaleHeight
                       ' PicTmp.Picture = LoadPicture("")
                        
                    End If
                    
                Case STATUS_Watching
                    
                    If gStatusOfVideo(i) = STATUS_VideoWrong Then
                        PicVideo(i - 1).Picture = LoadPicture("")
                       
                    End If
                
                Case STATUS_NormalRecording
                    
                    If gStatusOfVideo(i) = STATUS_VideoWrong Then
                        PicVideo(i - 1).Picture = LoadPicture("")
                      
                    End If
                
                Case STATUS_WarningRecord
                   
                    If gStatusOfVideo(i) = STATUS_VideoWrong Then
                        PicVideo(i - 1).Picture = LoadPicture("")
                        
                    End If
                
                End Select
                
                gStatusOfVideo(i) = iStatus
                
                ' 删除文件
                Kill sStatusFile
            End If
        Next i
End Sub

' 根据音视频通道数设置【单画面显示】按钮的按钮菜单项哪些可用
Private Sub InitButtonMenu()
        Dim i As Integer
        
        If gNumberOfSlots < Max_Slots Then
            For i = Max_Slots To gNumberOfSlots + 1 Step -1
                tbrShowControl.Buttons(1).ButtonMenus(i).Enabled = False
            Next
        End If
        
        If gNumberOfSlots <= 1 Then
            tbrShowControl.Buttons(2).Enabled = False
        ElseIf gNumberOfSlots <= 4 Then
            tbrShowControl.Buttons(3).Enabled = False
        End If
End Sub

'远程控制传输方面
Private Sub Winsockclient_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next

        Dim receivefile() As Byte
        Dim i As Integer
        Dim s As String
        Dim ServerNum As String
        Dim ChannelNum As String
        Dim IniFileName As String
        On Error Resume Next
        
        ReDim receivefile(1 To bytesTotal) As Byte
        
        Winsockclient.GetData receivefile, vbArray + vbByte  '告诉Winsock控件收到的是字节数组类型的数据
        
        
        If bytesTotal > 4 Then
            Open gGetIniPath & "\temp.ini" For Binary As #1
            
            For i = 0 To bytesTotal
                Put #1, , receivefile(i)
            Next i
            
            Close #1
            
            s = GetIni("temp.ini", "系统配置", "服务器号", "00")
                
                IniFileName = gGetIniPath & "Server" & s & ".ini"
             
              
                
                Open IniFileName For Binary As #1
                
                For i = 0 To bytesTotal
                    Put #1, , receivefile(i)
                Next i
                Close #1
                MsgBox "成功更新配置文件"
            
        End If
        
        If bytesTotal <= 4 Then
            ServerNum = (receivefile(0) - 48) & (receivefile(1) - 28)
            ChannelNum = (receivefile(2) - 48) & (receivefile(3) - 28)
        End If

End Sub

Private Sub WinsockEvents_DataArrival(ByVal bytesTotal As Long)
    Dim strEvents As String
    Dim strArray() As String
    Dim iChannelNum As Integer
    Dim iAddress As String
    WinsockEvents.GetData strEvents
        
'    strEvents = "2004年07月07日 18:01:35$2$1$2$无$1 $串口报警"
    strArray = Split(strEvents, "$")
                
    If InStr(strEvents, "运动检测") And iChannelStatus(strArray(1), strArray(5)) = 0 Then
        GoTo a1
    ElseIf InStr(strEvents, "视频丢失") And iLostStatus(strArray(1), strArray(5)) = 0 Then
        GoTo a1
    ElseIf InStr(strEvents, "串口报警") And iBaojingStatus(strArray(1), strArray(2), strArray(3)) = 0 Then
        GoTo a1
    Else
        Load frmEvents
        frmEvents.ReadEvents App.Path + "\报警日志.txt", Now
        fr

⌨️ 快捷键说明

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