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

📄 form1.frm

📁 显示屏测试程序的源程序
💻 FRM
📖 第 1 页 / 共 3 页
字号:

End Sub

Private Sub InitControl()
    If (nCommType = ZMJ_TEXT) Then
        LabelType.Caption = "文字"
        TextText.Visible = True
        LabelType.Visible = True
        ComboDateType.Visible = False
        TextDelay.Visible = False
        UpDownDelay.Visible = False
    ElseIf (nCommType = ZMJ_CLEAR) Then
        LabelType.Caption = "清除屏幕"
        TextText.Visible = False
        LabelType.Visible = True
        ComboDateType.Visible = False
        TextDelay.Visible = False
        UpDownDelay.Visible = False
    ElseIf (nCommType = ZMJ_DATE) Then
        LabelType.Caption = "日期类型"
        TextText.Visible = False
        LabelType.Visible = True
        ComboDateType.Visible = True
        TextDelay.Visible = False
        UpDownDelay.Visible = False
    ElseIf (nCommType = ZMJ_TIME) Then
        LabelType.Caption = "停留时间"
        TextText.Visible = False
        LabelType.Visible = True
        ComboDateType.Visible = False
        TextDelay.Visible = True
        UpDownDelay.Visible = True
    ElseIf (nCommType = ZMJ_PAUSE) Then
        LabelType.Caption = "停留时间"
        TextText.Visible = False
        LabelType.Visible = True
        ComboDateType.Visible = False
        TextDelay.Visible = True
        UpDownDelay.Visible = True
    End If
End Sub
Private Sub ButtonAdd_Click()
Dim strCommand As String
    If (bDuanNo) Then
        strCommand = CStr(UpDownDuanNo.Value)
        ListComm.AddItem (strCommand)
    Else
        If (nCommType = ZMJ_TEXT) Then
            nRetCode = ZmjTextWindow(myZmjFontType, myZmjFontStyle, strText, myZmjWindow)
            strCommand = "文字 "
            strCommand = strCommand + strText + " 方式" + CStr(myZmjFontType.byMode) + " 速度" + CStr(myZmjFontType.byRate) + " 字体" + CStr(myZmjFontType.byFontType)
        ElseIf (nCommType = ZMJ_CLEAR) Then
            nRetCode = ZmjClear()
            strCommand = "清屏"
        ElseIf (nCommType = ZMJ_DATE) Then
            nRetCode = ZmjMydateWindow(myZmjFontType, myZmjFontStyle, nDateType, myZmjWindow)
            strCommand = "日期"
            strCommand = strCommand + "日期类型" + CStr(nDateType) + " 方式" + CStr(myZmjFontType.byMode) + " 速度" + CStr(myZmjFontType.byRate) + " 字体" + CStr(myZmjFontType.byFontType)
        ElseIf (nCommType = ZMJ_TIME) Then
            nRetCode = ZmjDispTimeWindow(nDelayNum, myZmjFontType, myZmjWindow)
            strCommand = "时间"
            strCommand = strCommand + "停留时间" + CStr(nDelayNum) + " 方式" + CStr(myZmjFontType.byMode) + " 速度" + CStr(myZmjFontType.byRate) + " 字体" + CStr(myZmjFontType.byFontType)
        ElseIf (nCommType = ZMJ_PAUSE) Then
            nRetCode = ZmjDelay(nDelayNum * 1000)
            strCommand = "暂停"
            strCommand = strCommand + "停留时间" + CStr(nDelayNum)
        End If
        TextRet.Text = CStr(nRetCode)
        ListComm.AddItem (strCommand)
    End If
End Sub

Private Sub ButtonEnd_Click()
Dim nCount As Integer
Dim nTemp As Integer
Dim strTemp As String
Dim strDuan As String
Dim byTemp(63) As Byte

    If (bStartcomm = True) Then
        bStartcomm = False
        CommandStartPlayDuan.Enabled = True
        ButtonStart.Enabled = True
        ButtonEnd.Enabled = False
        ButtonAdd.Enabled = False
        ButtonDelete.Enabled = False
        ButtonUp.Enabled = False
        ButtonDown.Enabled = False
        
        CheckDuan.Enabled = True
        TextDuanNo.Enabled = True
        UpDownDuanNo.Enabled = True
        
        If (bDuanNo = False) Then
            LabelDisplay.Caption = "正在发送请稍后.."
            LabelDisplay.Refresh
            nRetCode = ZmjCommondEnd
            If (nRetCode = 1) Then
                LabelDisplay.Caption = "发送正确."
            Else
                LabelDisplay.Caption = "发送错误."
            End If
            TextRet.Text = CStr(nRetCode)
            CheckDuan.Visible = True
        Else
            nCount = ListComm.ListCount
            If (nCount > 63) Then
                nCount = 63
            End If
            strDuan = ""
            For nCount = 0 To nCount - 1 Step 1
                strTemp = ListComm.List(nCount)
                byTemp(nCount) = CByte(strTemp)
                strTemp = CStr(byTemp)
                strDuan = strDuan + strTemp
            Next nCount
            If (nCount > 0) Then
                LabelDisplay.Caption = "正在发送请稍后.."
                LabelDisplay.Refresh
                nRetCode = ZmjSetPlayDuan(0, 63, byTemp(0), nCount)
                If (nRetCode = 1) Then
                    LabelDisplay.Caption = "发送正确."
                Else
                    LabelDisplay.Caption = "发送错误."
                End If
                TextRet.Text = CStr(nRetCode)
            Else
                LabelDisplay.Caption = "播放表为空,不发送"
                LabelDisplay.Refresh
            End If
        End If
    End If
End Sub

Private Sub ButtonExit_Click()
    End
End Sub

Private Sub ButtonStart_Click()
    If (bStartcomm = False) Then
        While (ListComm.ListCount > 0)
            ListComm.RemoveItem (0)
        Wend
        bDuanNo = False
        bStartcomm = True
        CommandStartPlayDuan.Enabled = False
        ButtonStart.Enabled = False
        ButtonEnd.Enabled = True
        ButtonAdd.Enabled = True
        ButtonDelete.Enabled = True
        ButtonUp.Enabled = True
        ButtonDown.Enabled = True
        If (bMultiDuan = True) Then
            nRetCode = ZmjMultiCommondBegin(0, 63, nCurrentDuan)
        Else
            nRetCode = ZmjCommondBegin(0, 63)
        End If
        TextRet.Text = CStr(nRetCode)
        CheckDuan.Enabled = False
        TextDuanNo.Enabled = False
        UpDownDuanNo.Enabled = False
    End If
End Sub

Private Sub CheckDoubleLines_Click()
    myZmjFontStyle.byBiLines = CheckDoubleLines.Value
End Sub

Private Sub CheckDuan_Click()
    If (CheckDuan.Value = 1) Then
        bMultiDuan = True
        TextDuanNo.Visible = True
        UpDownDuanNo.Visible = True
    Else
        bMultiDuan = False
        TextDuanNo.Visible = False
        UpDownDuanNo.Visible = False
    End If
End Sub

Private Sub CheckReverse_Click()
    myZmjFontStyle.byReverse = CheckReverse.Value
End Sub

Private Sub ComboDateType_Change()
    nDateType = ComboDateType.ListIndex
End Sub

Private Sub ComboFormat_Change()
    myZmjFontType.byFormat = ComboFormat.ListIndex + 1
End Sub

Private Sub ComboMode_Change()
    myZmjFontType.byMode = ComboMode.ListIndex + 1
End Sub

Private Sub ComboMode_Click()
    myZmjFontType.byMode = ComboMode.ListIndex + 1

End Sub

Private Sub CommandStartPlayDuan_Click()
    If (bStartcomm = False) Then
        While (ListComm.ListCount > 0)
            ListComm.RemoveItem (0)
        Wend
        bDuanNo = True
        bStartcomm = True
        CommandStartPlayDuan.Enabled = False
        ButtonStart.Enabled = False
        ButtonEnd.Enabled = True
        ButtonAdd.Enabled = True
        ButtonDelete.Enabled = True
        ButtonUp.Enabled = True
        ButtonDown.Enabled = True
        If (bMultiDuan = True) Then
            nRetCode = ZmjMultiCommondBegin(0, 63, nCurrentDuan)
        Else
            nRetCode = ZmjCommondBegin(0, 63)
        End If
        TextRet.Text = CStr(nRetCode)
        CheckDuan.Enabled = False
        TextDuanNo.Enabled = True
        UpDownDuanNo.Enabled = True
        LabelDuanNo.Enabled = True
    End If

End Sub

Private Sub Form_Load()
    nRetCode = ZmjInit(1, 9600)
    TextRet.Text = CStr(nRetCode)
    strText = "1234567"
    nCommType = 0 '命令类型
    nDateType = 0 '日期类型
    nDelayNum = 1 '停留时间
    bMultiDuan = False
    nCurrentDuan = 0
    
    
    nRetCode = ZmjTextWindow(myZmjFontType, myZmjFontStyle, strText, myZmjWindow)
    nRetCode = ZmjMydateWindow(myZmjFontType, myZmjFontStyle, 1, myZmjWindow)
    
    ButtonStart.Enabled = True
    ButtonEnd.Enabled = False
    ButtonAdd.Enabled = False
    ButtonDelete.Enabled = False
    ButtonUp.Enabled = False
    ButtonDown.Enabled = False
    ButtonExit.Enabled = True
    
    ComboMode.ListIndex = 0
    ComboDateType.ListIndex = 0
    ComboFormat.ListIndex = 0
    
    CheckDoubleLines.Value = 0
    CheckReverse.Value = 0
    CheckDuan.Value = 0
        
    TextX0.Text = 0
    TextY0.Text = 0
    TextX1.Text = 280
    TextY1.Text = 32
    TextText.Text = ""
    TextDelay.Text = "1"
    TextZoom.Text = "1"
    TextSpace.Text = "0"
    TextVelocity.Text = "3"
    TextDuanNo = "0"
    
    UpDownDelay.Value = 1
    UpDownZoom.Value = 1
    UpDownSpace.Value = 0
    UpDownVelocity.Value = 3
    UpDownDuanNo = 0
    
    OptionFontType1.Value = 1
    OptionFore1.Value = 1
    OptionText.Value = 1
    
    bStartcomm = False
    InitControl
    InitData
End Sub

Private Sub TabStripType_Click(Index As Integer)
    
End Sub

Private Sub Form_Unload(Cancel As Integer)
    nRetCode = ZmjClose()
    'TextRet.Text = CStr(nRetCode)
End Sub

Private Sub MSComm1_OnComm()

End Sub

Private Sub LabelDisplay_Click()

End Sub

Private Sub OptionClear_Click()
    nCommType = ZMJ_CLEAR
    InitControl
End Sub

Private Sub OptionDate_Click()
    nCommType = ZMJ_DATE
    InitControl
End Sub

Private Sub OptionFontType1_Click()
    myZmjFontType.byFontType = 1
End Sub

Private Sub OptionFontType2_Click()
    myZmjFontType.byFontType = 2
End Sub

Private Sub OptionFontType3_Click()
    myZmjFontType.byFontType = 3
End Sub

Private Sub OptionFore1_Click()
    myZmjFontType.byColor = 0
End Sub

Private Sub OptionFore2_Click()
    myZmjFontType.byColor = 1
End Sub

Private Sub OptionFore3_Click()
    myZmjFontType.byColor = 2
End Sub

Private Sub OptionFore4_Click()
    myZmjFontType.byColor = 3
End Sub

Private Sub OptionPause_Click()
    nCommType = ZMJ_PAUSE
    InitControl
End Sub

Private Sub OptionText_Click()
    nCommType = ZMJ_TEXT
    InitControl
End Sub

Private Sub OptionTime_Click()
    nCommType = ZMJ_TIME
    InitControl
End Sub

Private Sub TextDelay_Change()
    nDelayNum = CInt(TextDelay.Text)
End Sub

Private Sub TextDuanNo_Change()
    nCurrentDuan = CInt(TextDuanNo.Text)
End Sub

Private Sub TextText_Change()
    strText = TextText.Text
End Sub

Private Sub TextX0_Change()
    Dim nPosition As Integer
    nPosition = CInt(TextX0.Text)
    myZmjWindow.wLeft = nPosition
End Sub

Private Sub TextX1_Change()
    Dim nPosition As Integer
    nPosition = CInt(TextX1.Text)
    myZmjWindow.wRight = nPosition
End Sub

Private Sub TextY0_Change()
    Dim nPosition As Integer
    nPosition = CInt(TextY0.Text)
    myZmjWindow.wTop = nPosition
End Sub

Private Sub TextY1_Change()
    Dim nPosition As Integer
    nPosition = CInt(TextY1.Text)
    myZmjWindow.wBottom = nPosition
End Sub

Private Sub UpDownDuanNo_Change()
    nCurrentDuan = UpDownDuanNo.Value
End Sub

Private Sub UpDownSpace_Change()
    myZmjFontType.byFontSpace = UpDownSpace.Value
End Sub

Private Sub UpDownVelocity_Change()
    myZmjFontType.byRate = UpDownVelocity.Value
End Sub

Private Sub UpDownZoom_Change()
    myZmjFontStyle.byWidthScale = UpDownZoom.Value
End Sub

⌨️ 快捷键说明

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