📄 ean13.frm
字号:
VERSION 5.00
Begin VB.Form Form13
Caption = "EN-13"
ClientHeight = 5205
ClientLeft = 60
ClientTop = 345
ClientWidth = 6510
BeginProperty Font
Name = "BankGothic Lt BT"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
Picture = "ean13.frx":0000
ScaleHeight = 5205
ScaleWidth = 6510
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "退 出"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4200
TabIndex = 5
Top = 4320
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "取 消"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2640
TabIndex = 4
Top = 4320
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确 定"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 960
MaskColor = &H00C0E0FF&
TabIndex = 2
Top = 4320
Width = 1455
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 = 3120
TabIndex = 1
Top = 3720
Width = 2415
End
Begin VB.PictureBox Picture1
BackColor = &H80000005&
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1455
Left = 240
ScaleHeight = 1395
ScaleWidth = 5835
TabIndex = 0
Top = 360
Width = 5895
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "请输入12位编码:"
BeginProperty Font
Name = "幼圆"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Left = 960
TabIndex = 3
Top = 3720
Width = 2055
End
End
Attribute VB_Name = "Form13"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim code(1 To 13) As Integer
Dim subset(0 To 9, 1 To 6) As String
Dim ean13a(0 To 9, 1 To 7) As Integer
Dim ean13b(0 To 9, 1 To 7) As Integer
Dim ean13c(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 < 12 Then
MsgBox "请输入12位的编码"
Text1.Text = ""
Text1.Enabled = True
Text1.SetFocus
Else
sum = 0
sumeven = 0
sumodd = 0
n = 50
h = 60
Form13.Width = 120 * n
Picture1.Width = 110 * n
CurrentX = (Picture1.Width - 95 * n) / 2
Picture1.FillStyle = 0
Picture1.FillColor = RGB(0, 0, 0)
For i = 1 To 12
a = Mid(Text1.Text, i, 1)
code(i) = Val(a)
code(1) = 0
If i Mod 2 = 0 Then
sumeven = sumeven + code(i)
Else
sumodd = sumodd + code(i)
End If
Next i
sum = sumeven * 3 + sumodd
If sum Mod 10 = 0 Then
code(13) = 0
Else
code(13) = 10 - sum Mod 10
End If
Text1.Text = Text1.Text & code(13)
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 i = 2 To 7
If subset(code(1), i - 1) = "A" Then
For j = 1 To 7
If ean13a(code(i), j) = 1 Then
Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height - 200), , B
End If
CurrentX = CurrentX + n
Next j
Else
For j = 1 To 7
If ean13b(code(i), j) = 1 Then
Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height - 200), , B
End If
CurrentX = CurrentX + n
Next j
End If
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 = 8 To 13
For j = 1 To 7
If ean13c(code(i), j) = 1 Then
Picture1.Line (CurrentX, h)-(CurrentX + n, Picture1.Height - 200), , B
End If
CurrentX = CurrentX + n
Next j
Next i
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 Form13
system.Show
End Sub
Private Sub Form_Load()
ean13a(0, 1) = 0: ean13a(0, 2) = 0: ean13a(0, 3) = 0: ean13a(0, 4) = 1: ean13a(0, 5) = 1: ean13a(0, 6) = 0: ean13a(0, 7) = 1
ean13a(1, 1) = 0: ean13a(1, 2) = 0: ean13a(1, 3) = 1: ean13a(1, 4) = 1: ean13a(1, 5) = 0: ean13a(1, 6) = 0: ean13a(1, 7) = 1
ean13a(2, 1) = 0: ean13a(2, 2) = 0: ean13a(2, 3) = 1: ean13a(2, 4) = 0: ean13a(2, 5) = 0: ean13a(2, 6) = 1: ean13a(2, 7) = 1
ean13a(3, 1) = 0: ean13a(3, 2) = 1: ean13a(3, 3) = 1: ean13a(3, 4) = 1: ean13a(3, 5) = 1: ean13a(3, 6) = 0: ean13a(3, 7) = 1
ean13a(4, 1) = 0: ean13a(4, 2) = 1: ean13a(4, 3) = 0: ean13a(4, 4) = 0: ean13a(4, 5) = 0: ean13a(4, 6) = 1: ean13a(4, 7) = 1
ean13a(5, 1) = 0: ean13a(5, 2) = 1: ean13a(5, 3) = 1: ean13a(5, 4) = 0: ean13a(5, 5) = 0: ean13a(5, 6) = 0: ean13a(5, 7) = 1
ean13a(6, 1) = 0: ean13a(6, 2) = 1: ean13a(6, 3) = 0: ean13a(6, 4) = 1: ean13a(6, 5) = 1: ean13a(6, 6) = 1: ean13a(6, 7) = 1
ean13a(7, 1) = 0: ean13a(7, 2) = 1: ean13a(7, 3) = 1: ean13a(7, 4) = 1: ean13a(7, 5) = 0: ean13a(7, 6) = 1: ean13a(7, 7) = 1
ean13a(8, 1) = 0: ean13a(8, 2) = 1: ean13a(8, 3) = 1: ean13a(8, 4) = 0: ean13a(8, 5) = 1: ean13a(8, 6) = 1: ean13a(8, 7) = 1
ean13a(9, 1) = 0: ean13a(9, 2) = 0: ean13a(9, 3) = 0: ean13a(9, 4) = 1: ean13a(9, 5) = 0: ean13a(9, 6) = 1: ean13a(9, 7) = 1
ean13b(0, 1) = 0: ean13b(0, 2) = 1: ean13b(0, 3) = 0: ean13b(0, 4) = 0: ean13b(0, 5) = 1: ean13b(0, 6) = 1: ean13b(0, 7) = 1
ean13b(1, 1) = 0: ean13b(1, 2) = 1: ean13b(1, 3) = 1: ean13b(1, 4) = 0: ean13b(1, 5) = 0: ean13b(1, 6) = 1: ean13b(1, 7) = 1
ean13b(2, 1) = 0: ean13b(2, 2) = 0: ean13b(2, 3) = 1: ean13b(2, 4) = 1: ean13b(2, 5) = 0: ean13b(2, 6) = 1: ean13b(2, 7) = 1
ean13b(3, 1) = 0: ean13b(3, 2) = 1: ean13b(3, 3) = 0: ean13b(3, 4) = 0: ean13b(3, 5) = 0: ean13b(3, 6) = 0: ean13b(3, 7) = 1
ean13b(4, 1) = 0: ean13b(4, 2) = 0: ean13b(4, 3) = 1: ean13b(4, 4) = 1: ean13b(4, 5) = 1: ean13b(4, 6) = 0: ean13b(4, 7) = 1
ean13b(5, 1) = 0: ean13b(5, 2) = 1: ean13b(5, 3) = 1: ean13b(5, 4) = 1: ean13b(5, 5) = 0: ean13b(5, 6) = 0: ean13b(5, 7) = 1
ean13b(6, 1) = 0: ean13b(6, 2) = 0: ean13b(6, 3) = 0: ean13b(6, 4) = 0: ean13b(6, 5) = 1: ean13b(6, 6) = 0: ean13b(6, 7) = 1
ean13b(7, 1) = 0: ean13b(7, 2) = 0: ean13b(7, 3) = 1: ean13b(7, 4) = 0: ean13b(7, 5) = 0: ean13b(7, 6) = 0: ean13b(7, 7) = 1
ean13b(8, 1) = 0: ean13b(8, 2) = 0: ean13b(8, 3) = 0: ean13b(8, 4) = 1: ean13b(8, 5) = 0: ean13b(8, 6) = 0: ean13b(8, 7) = 1
ean13b(9, 1) = 0: ean13b(9, 2) = 0: ean13b(9, 3) = 1: ean13b(9, 4) = 0: ean13b(9, 5) = 1: ean13b(9, 6) = 1: ean13b(9, 7) = 1
ean13c(0, 1) = 1: ean13c(0, 2) = 1: ean13c(0, 3) = 1: ean13c(0, 4) = 0: ean13c(0, 5) = 0: ean13c(0, 6) = 1: ean13c(0, 7) = 0
ean13c(1, 1) = 1: ean13c(1, 2) = 1: ean13c(1, 3) = 0: ean13c(1, 4) = 0: ean13c(1, 5) = 1: ean13c(1, 6) = 1: ean13c(1, 7) = 0
ean13c(2, 1) = 1: ean13c(2, 2) = 1: ean13c(2, 3) = 0: ean13c(2, 4) = 1: ean13c(2, 5) = 1: ean13c(2, 6) = 0: ean13c(2, 7) = 0
ean13c(3, 1) = 1: ean13c(3, 2) = 0: ean13c(3, 3) = 0: ean13c(3, 4) = 0: ean13c(3, 5) = 0: ean13c(3, 6) = 1: ean13c(3, 7) = 0
ean13c(4, 1) = 1: ean13c(4, 2) = 0: ean13c(4, 3) = 1: ean13c(4, 4) = 1: ean13c(4, 5) = 1: ean13c(4, 6) = 0: ean13c(4, 7) = 0
ean13c(5, 1) = 1: ean13c(5, 2) = 0: ean13c(5, 3) = 0: ean13c(5, 4) = 1: ean13c(5, 5) = 1: ean13c(5, 6) = 1: ean13c(5, 7) = 0
ean13c(6, 1) = 1: ean13c(6, 2) = 0: ean13c(6, 3) = 1: ean13c(6, 4) = 0: ean13c(6, 5) = 0: ean13c(6, 6) = 0: ean13c(6, 7) = 0
ean13c(7, 1) = 1: ean13c(7, 2) = 0: ean13c(7, 3) = 0: ean13c(7, 4) = 0: ean13c(7, 5) = 1: ean13c(7, 6) = 0: ean13c(7, 7) = 0
ean13c(8, 1) = 1: ean13c(8, 2) = 0: ean13c(8, 3) = 0: ean13c(8, 4) = 1: ean13c(8, 5) = 0: ean13c(8, 6) = 0: ean13c(8, 7) = 0
ean13c(9, 1) = 1: ean13c(9, 2) = 1: ean13c(9, 3) = 1: ean13c(9, 4) = 0: ean13c(9, 5) = 1: ean13c(9, 6) = 0: ean13c(9, 7) = 0
subset(0, 1) = "A": subset(0, 2) = "A": subset(0, 3) = "A": subset(0, 4) = "A": subset(0, 5) = "A": subset(0, 6) = "A"
subset(1, 1) = "A": subset(1, 2) = "A": subset(1, 3) = "B": subset(1, 4) = "A": subset(1, 5) = "B": subset(1, 6) = "B"
subset(2, 1) = "A": subset(2, 2) = "A": subset(2, 3) = "B": subset(2, 4) = "B": subset(2, 5) = "A": subset(2, 6) = "B"
subset(3, 1) = "A": subset(3, 2) = "A": subset(3, 3) = "B": subset(3, 4) = "B": subset(3, 5) = "B": subset(3, 6) = "A"
subset(4, 1) = "A": subset(4, 2) = "B": subset(4, 3) = "A": subset(4, 4) = "A": subset(4, 5) = "B": subset(4, 6) = "B"
subset(5, 1) = "A": subset(5, 2) = "B": subset(5, 3) = "B": subset(5, 4) = "A": subset(5, 5) = "A": subset(5, 6) = "B"
subset(6, 1) = "A": subset(6, 2) = "B": subset(6, 3) = "B": subset(6, 4) = "B": subset(6, 5) = "A": subset(6, 6) = "A"
subset(7, 1) = "A": subset(7, 2) = "B": subset(7, 3) = "A": subset(7, 4) = "B": subset(7, 5) = "A": subset(7, 6) = "B"
subset(8, 1) = "A": subset(8, 2) = "B": subset(8, 3) = "A": subset(8, 4) = "B": subset(8, 5) = "B": subset(8, 6) = "A"
subset(9, 1) = "A": subset(9, 2) = "B": subset(9, 3) = "B": subset(9, 4) = "A": subset(9, 5) = "B": subset(9, 6) = "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 = 12 Then Text1.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -