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

📄 窗口.frm

📁 51单片机控制LED点阵式汉显系统制作资料
💻 FRM
📖 第 1 页 / 共 4 页
字号:
        Next
    
    Next
    
    Exit Sub
    
ErrHandle:
    Close #1
    MsgBox "错误代号:" & Err.Number & vbCrLf & vbCrLf & "错误描述:" & Err.Description, vbInformation Or vbOKOnly, "错误 - 提取字模"
End Sub
'Bold or not?
Private Sub chkBold_Click()
    txtInput.FontBold = (chkBold.value = vbChecked)
    
    ChangeFont picOutput
       
    Call DrawPic(picOutput, txtInput.Text)
End Sub

'Italic or not?
Private Sub chkItalic_Click()
    txtInput.FontItalic = (chkItalic.value = vbChecked)
    
    ChangeFont picOutput
    
    Call DrawPic(picOutput, txtInput.Text)
End Sub

'Strikethrough or not?
Private Sub chkStrikeThrough_Click()
    txtInput.FontStrikethru = (chkStrikeThrough.value = vbChecked)
    
    ChangeFont picOutput
    
    Call DrawPic(picOutput, txtInput.Text)
End Sub
'Underline or not?
Private Sub chkUnderline_Click()
    txtInput.FontUnderline = (chkUnderline.value = vbChecked)
    
    ChangeFont picOutput
    
    Call DrawPic(picOutput, txtInput.Text)
End Sub
'width is equal to height or not?
Private Sub chkWH_Click()
    Call ChangeFont(picOutput)
End Sub

'copy the text to clipboard
Private Sub cmdCopy_Click()
    Clipboard.Clear
    Clipboard.SetText txtOutput.Text
End Sub

'get the lattice for the special char
Private Sub cmdOK_Click()
    Dim strRet As String
    
    If mode = MODE_ASM Then
        txtOutput = "DB "
    Else
        txtOutput = ""
    End If
    

    
    If optMode(0).value = True Then
        strRet = GetValue_Horizontal(True)
    ElseIf optMode(1).value = True Then
        strRet = GetValue_Horizontal(False)
    ElseIf optMode(2).value = True Then
        strRet = GetValue_Vertical(True)
    ElseIf optMode(3).value = True Then
        strRet = GetValue_Vertical(False)
    
    ElseIf optMode(4).value = True Then
        strRet = GetValue_ShuZhe(True)
    
    Else
        strRet = GetValue_ShuZhe(False)
    
    End If
    
    txtOutput = txtOutput & strRet
End Sub




Private Function GetValue_ShuZhe(LeftFirst As Boolean) As String
    
    Dim i As Long, j As Long
    Dim value As Long, strRet As String, strRetNo1 As String, strRetNo2 As String
    
    If LeftFirst Then
        
        For j = 0 To (row_1 + 1) * ((col_1 + 1) \ 8) - 1
        
            value = 0
        
                For i = 0 To 7 Step 1
            
                    If m_bHighLight(IIf(j Mod 2 = 0, i, i + 8), j \ 2) = True Then
                    
                        value = value + 2 ^ (7 - i)
                    
                    End If
            
                Next
            
                    If mode = MODE_ASM Then
                                       strRet = strRet & IIf(value < 16, "0", "") & Hex(value) & "H,"
                    Else
                                       strRet = strRet & "0x" & IIf(value < 16, "0", "") & Hex(value) & ","
                    End If
            
                    If (1 + j) Mod (1 + row_1) = 0 Then strRet = strRet & vbCrLf & IIf(mode = MODE_ASM, "   ", "")
            
            
        Next
        strRet = Left(Trim(strRet), Len(Trim(strRet)) - 3)
        
    Else
        
        For j = 0 To 31
        
            value = 0
        
                For i = 0 To 7 Step 1
            
                    If m_bHighLight(IIf(j Mod 2 = 0, i, i + 8), j \ 2) = True Then
                    
                        value = value + 2 ^ (7 - i)
                    
                    End If
                
                Next
            
                    If mode = MODE_ASM Then
                                       If (j + 3) Mod 2 = 0 Then
                                       strRetNo2 = strRetNo2 & IIf(value < 16, "0", "") & Hex(value) & "H,"
                                       Else
                                       strRetNo1 = strRetNo1 & IIf(value < 16, "0", "") & Hex(value) & "H,"
                                       End If
                    
                    Else
                                       If (j + 3) Mod 2 = 0 Then
                                       strRetNo2 = strRetNo2 & "0x" & IIf(value < 16, "0", "") & Hex(value) & ","
                                       Else
                                       strRetNo1 = strRetNo1 & "0x" & IIf(value < 16, "0", "") & Hex(value) & ","
                                       End If
                                      
                    
                    End If
            
                    
'                    If (1 + j) Mod (1 + row_1) = 0 Then strRet = strRet & vbCrLf & IIf(mode = MODE_ASM, "   ", "")
            
        Next
        
        strRet = strRetNo1 & vbCrLf & IIf(mode = MODE_ASM, "   ", "") & strRetNo2
           
        'remove the backmost  'vbCrlf' and the backmost  ','
        strRet = Left(Trim(strRet), Len(Trim(strRet)) - 1)
    
    End If
    
    GetValue_ShuZhe = strRet
    
End Function






Private Function GetValue_Horizontal(LeftFirst As Boolean) As String  '20060809
    
    Dim i As Long, j As Long
    Dim value As Long, strRet As String
    
    If LeftFirst Then
        
        For i = 0 To (row_1 + 1) * ((col_1 + 1) \ 8) - 1
            
            value = 0
            
            For j = 7 To 0 Step -1
                
                If m_bHighLight(i \ 2, IIf(i Mod 2 = 0, j, j + 8)) = True Then
                    
                    value = value + 2 ^ (7 - j)
                    
                End If
            
            Next
            
            If mode = MODE_ASM Then
                strRet = strRet & IIf(value < 16, "0", "") & Hex(value) & "H,"
            Else
                strRet = strRet & "0x" & IIf(value < 16, "0", "") & Hex(value) & ","
            End If
            
            If (1 + i) Mod (1 + row_1) = 0 Then strRet = strRet & vbCrLf & IIf(mode = MODE_ASM, "   ", "")
            
        Next
        
    Else
        
        For i = 0 To (row_1 + 1) * ((col_1 + 1) \ 8) - 1
            
            value = 0
            
            For j = 7 To 0 Step -1
                
                If m_bHighLight(i \ 2, IIf(i Mod 2 = 0, j + 8, j)) = True Then
                    
                    value = value + 2 ^ (7 - j)
                    
                End If
            
            Next
            
            If mode = MODE_ASM Then
                strRet = strRet & IIf(value < 16, "0", "") & Hex(value) & "H,"
            Else
                strRet = strRet & "0x" & IIf(value < 16, "0", "") & Hex(value) & ","
            End If
            
            If (1 + i) Mod (1 + row_1) = 0 Then strRet = strRet & vbCrLf & IIf(mode = MODE_ASM, "   ", "")
            
        Next
        
    End If
    'remove the backmost  'vbCrlf' and the backmost  ','
    strRet = Left(Trim(strRet), Len(Trim(strRet)) - 3)
    GetValue_Horizontal = strRet
    
End Function









Private Function GetValue_Vertical(LeftFirst As Boolean) As String
    Dim i As Long, j As Long
    Dim value As Long
    Dim lstr As String, rstr As String
    
    For i = 0 To row_1
        
        value = 0
        
        For j = 7 To 0 Step -1
        
            If m_bHighLight(i, j) = True Then
                
                    value = value + 2 ^ (7 - j)
                    
            End If
            
        Next
        
        If mode = MODE_ASM Then
            lstr = lstr & IIf(value < 16, "0", "") & Hex(value) & "H,"
        Else
            lstr = lstr & "0x" & IIf(value < 16, "0", "") & Hex(value) & ","
        End If
        
    Next

    For i = 0 To row_1
        
        value = 0
        
        For j = 7 To 0 Step -1
        
            If m_bHighLight(i, j + 8) = True Then
                
                    value = value + 2 ^ (7 - j)
                    
            End If
            
        Next
        
        If mode = MODE_ASM Then
            rstr = rstr & IIf(value < 16, "0", "") & Hex(value) & "H,"
        Else
            rstr = rstr & "0x" & IIf(value < 16, "0", "") & Hex(value) & ","
        End If
        
    Next
    
    If LeftFirst Then
        
        GetValue_Vertical = lstr & vbCrLf & IIf(mode = MODE_ASM, "   ", "") & Left(rstr, Len(rstr) - 1) 'Left(lstr & rstr, Len(lstr & rstr) - 1)
        
    Else
    
        GetValue_Vertical = rstr & vbCrLf & IIf(mode = MODE_ASM, "   ", "") & Left(lstr, Len(lstr) - 1) 'Left(rstr & lstr, Len(rstr & lstr) - 1)
        
    End If
    
End Function

Private Sub cmdRotateLeft_Click()
    Dim temp(row_1, col_1) As Boolean
    Dim i As Long, j As Long
    
    For i = 0 To row_1
    
        For j = 0 To col_1
        
            temp(i, j) = m_bHighLight(j, row_1 - i)
            
        Next
        
    Next
    
    For i = 0 To row_1
    
        For j = 0 To col_1
        
            m_bHighLight(i, j) = temp(i, j)
        
        Next
    
    Next
    
    Call DrawShape
End Sub

Private Sub cmdRotateRight_Click()
    Dim temp(row_1, col_1) As Boolean
    Dim i As Long, j As Long
    
    For i = 0 To row_1
    
        For j = 0 To col_1
        
            temp(i, j) = m_bHighLight(row_1 - j, i)
            
        Next
        
    Next
    
    For i = 0 To row_1
    
        For j = 0 To col_1
        
            m_bHighLight(i, j) = temp(i, j)
            
        Next
    
    Next
    
    Call DrawShape
End Sub





Private Sub Form_Initialize()
    InitCommonControls
End Sub

Private Sub Form_Load()
        
    InitMaskControls
    
    Call InitColor
    
    mode = MODE_ASM

    Me.Show
    
    Call InitShape
    
    Call InitPictureBox(picOutput)
    

⌨️ 快捷键说明

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