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

📄 form1.frm

📁 用VB编写的一个LCD点阵液晶的字库程序
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   7860
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   10800
   LinkTopic       =   "Form1"
   ScaleHeight     =   7860
   ScaleWidth      =   10800
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command9 
      Caption         =   "汉字12*12"
      Height          =   495
      Left            =   6600
      TabIndex        =   18
      Top             =   1800
      Width           =   735
   End
   Begin VB.CommandButton Command8 
      Caption         =   "汉字16*16"
      Height          =   495
      Left            =   7440
      TabIndex        =   16
      Top             =   1800
      Width           =   735
   End
   Begin VB.CommandButton Command7 
      Caption         =   "全"
      Height          =   495
      Left            =   4680
      TabIndex        =   15
      Top             =   2280
      Width           =   375
   End
   Begin VB.CommandButton Command6 
      Caption         =   "图形12864"
      Height          =   495
      Left            =   3600
      TabIndex        =   14
      Top             =   2280
      Width           =   1095
   End
   Begin VB.CommandButton Command5 
      Caption         =   "15字母 16*12"
      Height          =   495
      Left            =   7320
      TabIndex        =   11
      Top             =   2280
      Width           =   855
   End
   Begin VB.CommandButton Command4 
      Caption         =   "30字母8*6"
      Height          =   495
      Left            =   6480
      TabIndex        =   10
      Top             =   2280
      Width           =   855
   End
   Begin VB.TextBox Text3 
      Height          =   270
      Left            =   3960
      TabIndex        =   9
      Text            =   "0"
      Top             =   1440
      Width           =   735
   End
   Begin VB.TextBox Text2 
      Height          =   270
      Left            =   3960
      TabIndex        =   8
      Text            =   "0"
      Top             =   1800
      Width           =   735
   End
   Begin VB.PictureBox DPic 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      ForeColor       =   &H80000008&
      Height          =   975
      Left            =   6000
      ScaleHeight     =   63
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   63
      TabIndex        =   7
      Top             =   480
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "字母  8*6"
      Height          =   495
      Left            =   5640
      TabIndex        =   6
      Top             =   2280
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "AscII"
      Height          =   375
      Left            =   3960
      TabIndex        =   5
      Top             =   960
      Width           =   975
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   4080
      Top             =   240
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton tuxing 
      Caption         =   "全屏"
      Height          =   495
      Left            =   2520
      TabIndex        =   4
      Top             =   2280
      Width           =   855
   End
   Begin VB.CommandButton danzi 
      Caption         =   "单字16*16"
      Height          =   495
      Left            =   1440
      TabIndex        =   3
      Top             =   2280
      Width           =   855
   End
   Begin VB.CommandButton Command3 
      Caption         =   "载入"
      Height          =   495
      Left            =   240
      TabIndex        =   2
      Top             =   2280
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   3375
      Left            =   120
      MultiLine       =   -1  'True
      TabIndex        =   1
      Text            =   "Form1.frx":0000
      Top             =   2880
      Width           =   8175
   End
   Begin VB.PictureBox PLCD 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      ForeColor       =   &H80000008&
      Height          =   1950
      Left            =   240
      ScaleHeight     =   128
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   240
      TabIndex        =   0
      Top             =   240
      Width           =   3630
   End
   Begin VB.Label Label3 
      Caption         =   "黑体英文8号 宋体中文9号12*12 宋体12 16*16"
      Height          =   1575
      Left            =   240
      TabIndex        =   17
      Top             =   6360
      Width           =   8175
   End
   Begin VB.Label Label2 
      Caption         =   "纵坐标"
      Height          =   255
      Left            =   4800
      TabIndex        =   13
      Top             =   1800
      Width           =   1455
   End
   Begin VB.Label Label1 
      Caption         =   "横坐标"
      Height          =   255
      Left            =   4800
      TabIndex        =   12
      Top             =   1440
      Width           =   975
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim oz(29, 127) As Byte
Dim pic(239, 127) As Integer


Private Sub Command1_Click()
    For q = 33 To 220
        m = m + Chr(q) + "         " + Str(q) + "         0x" + Hex(q) + Chr(13) + Chr(10)
        Text1.Text = m
    Next
End Sub

Private Sub Command2_Click()
Dim temp As String
temp = ""
k = Text2.Text
l = Text3.Text
DPic.Cls
DPic.Line (0, 0)-(64, 64), RGB(0, 0, 255), BF
        For y = 0 To 5

            m = 0
            For q = 0 To 7
                If pic(y + l, q + k) = 1 Then m = m Or (2 ^ q): DPic.Line (y * 2, q * 2)-(y * 2 + 2, q * 2 + 2), RGB(0, 0, 0), BF Else DPic.Line (y * 2, q * 2)-(y * 2 + 2, q * 2 + 2), RGB(255, 255, 255), BF
            Next
            If m < 16 Then temp = temp + "0x0" + Hex(m) + "," Else temp = temp + "0x" + Hex(m) + ","
            

        Next
                    temp = temp + Chr(13) + Chr(10)

        
    Text1.Text = temp
End Sub

Private Sub Command3_Click()
    CommonDialog1.ShowOpen  '打开文件
    PLCD.Picture = LoadPicture(CommonDialog1.FileName)
    
    
    For j = 0 To 127
    For i = 0 To 239
        col = PLCD.Point(i, j)
        If (col And &HFF + (col And 65280) / 256 + (col And &HFF0000) / 65536) / 3 > 128 Then pic(i, j) = 0 Else pic(i, j) = 1
    Next
    Next
End Sub

Private Sub Command4_Click()
Dim temp As String
temp = ""
k = Text2.Text
l = Text3.Text
DPic.Cls
DPic.Line (0, 0)-(64, 64), RGB(0, 0, 255), BF

For j = 0 To 30
        For y = 0 To 5

            m = 0
            For q = 0 To 7
                If pic(y + l + j * 6, q + k) = 1 Then m = m Or (2 ^ q)
            Next
            If m < 16 Then temp = temp + "0x0" + Hex(m) + "," Else temp = temp + "0x" + Hex(m) + ","
            

        Next
                    temp = temp + Chr(13) + Chr(10)
Next

        
    Text1.Text = temp
End Sub

Private Sub Command5_Click()
Dim temp As String
temp = ""
k = Text2.Text
l = Text3.Text
DPic.Cls
DPic.Line (0, 0)-(64, 64), RGB(0, 0, 255), BF

For j = 0 To 14
        For y = 0 To 11
            m = 0
            For q = 0 To 7
                If pic(y + l + j * 12, q + k) = 1 Then m = m Or (2 ^ q)
            Next
            If m < 16 Then temp = temp + "0x0" + Hex(m) + "," Else temp = temp + "0x" + Hex(m) + ","
        Next
        temp = temp + Chr(13) + Chr(10)
        
        For y = 0 To 11
            m = 0
            For q = 0 To 7
                If pic(y + l + j * 12, q + k + 8) = 1 Then m = m Or (2 ^ q)
            Next
            If m < 16 Then temp = temp + "0x0" + Hex(m) + "," Else temp = temp + "0x" + Hex(m) + ","
        Next
        temp = temp + Chr(13) + Chr(10)
Next

        
    Text1.Text = temp
End Sub

Private Sub Command6_Click()
Dim temp As String
temp = ""
k = (Text2.Text + 7) \ 8
Text2.Text = k * 8
l = Text3.Text

DPic.Cls
PLCD.Line (0, k * 8)-(239, 127), RGB(0, 0, 255), BF
PLCD.Line (l, 0)-(239, 127), RGB(0, 0, 255), BF

For j = 0 To k - 1
        For y = 0 To l - 1

            m = 0
            For q = 0 To 7
                If pic(y, q + j * 8) = 1 Then m = m Or (2 ^ q)
            Next
            If m < 16 Then temp = temp + "0x0" + Hex(m) + "," Else temp = temp + "0x" + Hex(m) + ","
            

        Next
                    temp = temp + Chr(13) + Chr(10)
Next

        
    Text1.Text = temp
End Sub

Private Sub Command7_Click()
Dim temp As String
temp = ""

Text2.Text = 64
k = 8
l = 128
Text3.Text = 128

DPic.Cls
PLCD.Line (0, k * 8)-(239, 127), RGB(0, 0, 255), BF
PLCD.Line (l, 0)-(239, 127), RGB(0, 0, 255), BF

For j = 0 To k - 1
        For y = 0 To l - 1

            m = 0
            For q = 0 To 7
                If pic(y, q + j * 8) = 1 Then m = m Or (2 ^ q)
            Next
            If m < 16 Then temp = temp + "0x0" + Hex(m) + "," Else temp = temp + "0x" + Hex(m) + ","
            

        Next
                    temp = temp + Chr(13) + Chr(10)
Next

        
    Text1.Text = temp
End Sub

Private Sub Command8_Click()
Dim temp As String
temp = ""
k = Text2.Text
l = Text3.Text
DPic.Cls
DPic.Line (0, 0)-(64, 64), RGB(0, 0, 255), BF


For y = 0 To 15
    m = 0
    For q = 0 To 7
        If pic(y + l, q + k) = 1 Then m = m Or (2 ^ q)
    Next
    If m < 16 Then temp = temp + "0x0" + Hex(m) + "," Else temp = temp + "0x" + Hex(m) + ","
Next
temp = temp + Chr(13) + Chr(10)

For y = 0 To 15
    m = 0
    For q = 0 To 7
        If pic(y + l, q + k + 8) = 1 Then m = m Or (2 ^ q)
    Next
    If m < 16 Then temp = temp + "0x0" + Hex(m) + "," Else temp = temp + "0x" + Hex(m) + ","
Next
temp = temp + Chr(13) + Chr(10)

Text1.Text = temp
End Sub

Private Sub Command9_Click()
Dim temp As String
temp = ""
k = Text2.Text
l = Text3.Text
DPic.Cls
DPic.Line (0, 0)-(64, 64), RGB(0, 0, 255), BF


For y = 0 To 11
    m = 0
    For q = 0 To 7
        If pic(y + l, q + k) = 1 Then m = m Or (2 ^ q)
    Next
    If m < 16 Then temp = temp + "0x0" + Hex(m) + "," Else temp = temp + "0x" + Hex(m) + ","
Next
temp = temp + Chr(13) + Chr(10)

For y = 0 To 5
    m = 0
    For q = 0 To 3
        If pic(y + l, q + k + 8) = 1 Then m = m Or (2 ^ q)
        If pic(y + l + 6, q + k + 8) = 1 Then m = m Or (2 ^ (q + 4))
    Next
    If m < 16 Then temp = temp + "0x0" + Hex(m) + "," Else temp = temp + "0x" + Hex(m) + ","
Next
temp = temp + Chr(13) + Chr(10)

Text1.Text = temp
End Sub

Private Sub tuxing_Click()
Dim temp As String
temp = ""
        For z = 0 To 15
        For y = 0 To 7
        For X = 0 To 29
            oz(X, y + 8 * z) = 0
            
            For q = 0 To 7
                If pic(X * 8 + q, y + 8 * z) = 1 Then oz(X, y + 8 * z) = oz(X, y + 8 * z) Or (2 ^ (7 - q))
            Next
            If oz(X, y + z * 8) < 16 Then temp = temp + "0x0" + Hex(oz(X, y + z * 8)) + "," Else temp = temp + "0x" + Hex(oz(X, y + z * 8)) + ","
            
        Next
        temp = temp + Chr(13) + Chr(10)
        Next
        If z = 7 Then temp = temp + Chr(13) + Chr(10) + Chr(13) + Chr(10)
        Next
        
    Text1.Text = temp
End Sub

Private Sub danzi_Click()
Dim temp As String
temp = ""
        For z = 0 To 1
        For y = 0 To 7
        For X = 0 To 1
            oz(X, y + 8 * z) = 0
            
            For q = 0 To 7
                If pic(X * 8 + q, y + 8 * z) = 1 Then oz(X, y + 8 * z) = oz(X, y + 8 * z) Or (2 ^ (7 - q))
            Next
            If oz(X, y + z * 8) < 16 Then temp = temp + "0x0" + Hex(oz(X, y + z * 8)) + "," Else temp = temp + "0x" + Hex(oz(X, y + z * 8)) + ","
            
        Next
        Next
                    temp = temp + Chr(13) + Chr(10)
        Next
        
    Text1.Text = temp

End Sub

⌨️ 快捷键说明

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