📄 en-8.frm
字号:
VERSION 5.00
Begin VB.Form Form8
Caption = "EN-8"
ClientHeight = 5025
ClientLeft = 60
ClientTop = 345
ClientWidth = 6360
LinkTopic = "Form1"
Picture = "EN-8.frx":0000
ScaleHeight = 5025
ScaleWidth = 6360
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "退 出"
Height = 375
Left = 4440
TabIndex = 5
Top = 3840
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 375
Left = 2760
TabIndex = 4
Top = 3840
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确 定"
Height = 375
Left = 1200
TabIndex = 2
Top = 3840
Width = 1335
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3360
TabIndex = 1
Top = 3120
Width = 1935
End
Begin VB.PictureBox Picture1
BackColor = &H80000005&
Height = 1455
Left = 120
ScaleHeight = 1395
ScaleWidth = 5955
TabIndex = 0
Top = 360
Width = 6015
End
Begin VB.Label Label1
Alignment = 2 'Center
BackColor = &H00FFFFFF&
BackStyle = 0 'Transparent
Caption = "请输入7位编码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Left = 1440
TabIndex = 3
Top = 3240
Width = 1935
End
End
Attribute VB_Name = "Form8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim code(1 To 8) As Integer
Dim subset(0 To 9, 1 To 4) As String
Dim ean8a(0 To 9, 1 To 7) As Integer
Dim ean8c(0 To 9, 1 To 7) As Integer
Private Sub Command1_Click()
Dim l, sum, sumeven, sumodd, n, i, j, h As Integer
Dim a As String
l = Len(Text1.Text)
If l < 7 Then
MsgBox "请输入7位的编码"
Text1.Text = ""
Text1.Enabled = True
Text1.SetFocus
Else
sum = 0
sumeven = 0
sumodd = 0
n = 50
h = 60
Form8.Width = 120 * n
Picture1.Width = 110 * n
CurrentX = (Picture1.Width - 67 * n) / 2
Picture1.FillStyle = 0
Picture1.FillColor = RGB(0, 0, 0)
For i = 1 To 7
a = Mid(Text1.Text, i, 1)
code(i) = Val(a)
If i Mod 2 = 0 Then
sumeven = sumeven + code(i)
Else
sumodd = sumodd + code(i)
End If
Next i
sum = sumeven + sumodd * 3
If sum Mod 10 = 0 Then
code(8) = 0
Else
code(8) = 10 - sum Mod 10
End If
Text1.Text = Text1.Text & code(8)
Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height), , B
CurrentX = CurrentX + n
CurrentX = CurrentX + n
Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height), , B
CurrentX = CurrentX + n
' For j = 1 To 7
' If ean8a(code(1), j) = 1 Then
' Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height), , B
' End If
' CurrentX = CurrentX + n
' Next j
For i = 1 To 4
For j = 1 To 7
If ean8a(code(i), j) = 1 Then
Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height - 200), , B
End If
CurrentX = CurrentX + n
Next j
Next i
CurrentX = CurrentX + n
Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height), , B
CurrentX = CurrentX + n
CurrentX = CurrentX + n
Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height), , B
CurrentX = CurrentX + n
CurrentX = CurrentX + n
For i = 5 To 8
For j = 1 To 7
If ean8c(code(i), j) = 1 Then
Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height - 200), , B
End If
CurrentX = CurrentX + n
Next j
Next i
' For j = 1 To 7
'If ean8a(code(8), j) = 1 Then
' Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height), , B
' End If
' CurrentX = CurrentX + n
' Next j
CurrentX = CurrentX + n
Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height), , B
CurrentX = CurrentX + n
CurrentX = CurrentX + n
Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height), , B
CurrentX = CurrentX + n
End If
End Sub
Private Sub Command2_Click()
Text1.Enabled = True
Text1.Text = ""
Picture1.Cls
Text1.SetFocus
End Sub
Private Sub Command3_Click()
Unload Form8
system.Show
End Sub
Private Sub Form_Load()
ean8a(0, 1) = 0: ean8a(0, 2) = 0: ean8a(0, 3) = 0: ean8a(0, 4) = 1: ean8a(0, 5) = 1: ean8a(0, 6) = 0: ean8a(0, 7) = 1
ean8a(1, 1) = 0: ean8a(1, 2) = 0: ean8a(1, 3) = 1: ean8a(1, 4) = 1: ean8a(1, 5) = 0: ean8a(1, 6) = 0: ean8a(1, 7) = 1
ean8a(2, 1) = 0: ean8a(2, 2) = 0: ean8a(2, 3) = 1: ean8a(2, 4) = 0: ean8a(2, 5) = 0: ean8a(2, 6) = 1: ean8a(2, 7) = 1
ean8a(3, 1) = 0: ean8a(3, 2) = 1: ean8a(3, 3) = 1: ean8a(3, 4) = 1: ean8a(3, 5) = 1: ean8a(3, 6) = 0: ean8a(3, 7) = 1
ean8a(4, 1) = 0: ean8a(4, 2) = 1: ean8a(4, 3) = 0: ean8a(4, 4) = 0: ean8a(4, 5) = 0: ean8a(4, 6) = 1: ean8a(4, 7) = 1
ean8a(5, 1) = 0: ean8a(5, 2) = 1: ean8a(5, 3) = 1: ean8a(5, 4) = 0: ean8a(5, 5) = 0: ean8a(5, 6) = 0: ean8a(5, 7) = 1
ean8a(6, 1) = 0: ean8a(6, 2) = 1: ean8a(6, 3) = 0: ean8a(6, 4) = 1: ean8a(6, 5) = 1: ean8a(6, 6) = 1: ean8a(6, 7) = 1
ean8a(7, 1) = 0: ean8a(7, 2) = 1: ean8a(7, 3) = 1: ean8a(7, 4) = 1: ean8a(7, 5) = 0: ean8a(7, 6) = 1: ean8a(7, 7) = 1
ean8a(8, 1) = 0: ean8a(8, 2) = 1: ean8a(8, 3) = 1: ean8a(8, 4) = 0: ean8a(8, 5) = 1: ean8a(8, 6) = 1: ean8a(8, 7) = 1
ean8a(9, 1) = 0: ean8a(9, 2) = 0: ean8a(9, 3) = 0: ean8a(9, 4) = 1: ean8a(9, 5) = 0: ean8a(9, 6) = 1: ean8a(9, 7) = 1
ean8c(0, 1) = 1: ean8c(0, 2) = 1: ean8c(0, 3) = 1: ean8c(0, 4) = 0: ean8c(0, 5) = 0: ean8c(0, 6) = 1: ean8c(0, 7) = 0
ean8c(1, 1) = 1: ean8c(1, 2) = 1: ean8c(1, 3) = 0: ean8c(1, 4) = 0: ean8c(1, 5) = 1: ean8c(1, 6) = 1: ean8c(1, 7) = 0
ean8c(2, 1) = 1: ean8c(2, 2) = 1: ean8c(2, 3) = 0: ean8c(2, 4) = 1: ean8c(2, 5) = 1: ean8c(2, 6) = 0: ean8c(2, 7) = 0
ean8c(3, 1) = 1: ean8c(3, 2) = 0: ean8c(3, 3) = 0: ean8c(3, 4) = 0: ean8c(3, 5) = 0: ean8c(3, 6) = 1: ean8c(3, 7) = 0
ean8c(4, 1) = 1: ean8c(4, 2) = 0: ean8c(4, 3) = 1: ean8c(4, 4) = 1: ean8c(4, 5) = 1: ean8c(4, 6) = 0: ean8c(4, 7) = 0
ean8c(5, 1) = 1: ean8c(5, 2) = 0: ean8c(5, 3) = 0: ean8c(5, 4) = 1: ean8c(5, 5) = 1: ean8c(5, 6) = 1: ean8c(5, 7) = 0
ean8c(6, 1) = 1: ean8c(6, 2) = 0: ean8c(6, 3) = 1: ean8c(6, 4) = 0: ean8c(6, 5) = 0: ean8c(6, 6) = 0: ean8c(6, 7) = 0
ean8c(7, 1) = 1: ean8c(7, 2) = 0: ean8c(7, 3) = 0: ean8c(7, 4) = 0: ean8c(7, 5) = 1: ean8c(7, 6) = 0: ean8c(7, 7) = 0
ean8c(8, 1) = 1: ean8c(8, 2) = 0: ean8c(8, 3) = 0: ean8c(8, 4) = 1: ean8c(8, 5) = 0: ean8c(8, 6) = 0: ean8c(8, 7) = 0
ean8c(9, 1) = 1: ean8c(9, 2) = 1: ean8c(9, 3) = 1: ean8c(9, 4) = 0: ean8c(9, 5) = 1: ean8c(9, 6) = 0: ean8c(9, 7) = 0
subset(0, 1) = "A": subset(0, 2) = "A": subset(0, 3) = "A": subset(0, 4) = "A"
subset(1, 1) = "A": subset(1, 2) = "A": subset(1, 3) = "A": subset(1, 4) = "A"
subset(2, 1) = "A": subset(2, 2) = "A": subset(2, 3) = "A": subset(2, 4) = "A"
subset(3, 1) = "A": subset(3, 2) = "A": subset(3, 3) = "A": subset(3, 4) = "A"
subset(4, 1) = "A": subset(4, 2) = "A": subset(4, 3) = "A": subset(4, 4) = "A"
subset(5, 1) = "A": subset(5, 2) = "A": subset(5, 3) = "A": subset(5, 4) = "A"
subset(6, 1) = "A": subset(6, 2) = "A": subset(6, 3) = "A": subset(6, 4) = "A"
subset(7, 1) = "A": subset(7, 2) = "A": subset(7, 3) = "A": subset(7, 4) = "A"
subset(8, 1) = "A": subset(8, 2) = "A": subset(8, 3) = "A": subset(8, 4) = "A"
subset(9, 1) = "A": subset(9, 2) = "A": subset(9, 3) = "A": subset(9, 4) = "A"
Picture1.BackColor = RGB(255, 255, 255)
Text1.TabIndex = 0
Text1.Text = ""
Text1.Enabled = True
Label1.FontSize = 12
Label1.FontBold = True
Label1.FontItalic = True
End Sub
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Dim a, l As Integer
l = Len(Text1.Text)
If KeyCode >= &H30 And KeyCode <= &H39 Or KeyCode >= &H60 And KeyCode <= &H69 Then
a = 1
Else
a = 0
End If
If l = 7 Then Text1.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -