VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form Form1 
   Caption         =   "二维条码生成演示"
   ClientHeight    =   8160
   ClientLeft      =   7440
   ClientTop       =   5160
   ClientWidth     =   6495
   LinkTopic       =   "Form1"
   ScaleHeight     =   8160
   ScaleWidth      =   6495
   StartUpPosition =   2  'CenterScreen
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   120
      Top             =   4800
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      DefaultExt      =   "*.bmp"
      DialogTitle     =   "打开文件"
      Filter          =   "位图文件 |*.bmp|所有文件 |*.*"
   End
   Begin VB.CommandButton Command3 
      Caption         =   "保存"
      Height          =   375
      Left            =   4440
      TabIndex        =   28
      Top             =   7320
      Width           =   1575
   End
   Begin VB.CommandButton Command2 
      Caption         =   "从文件生成"
      Height          =   375
      Left            =   2280
      TabIndex        =   27
      Top             =   7320
      Width           =   1455
   End
   Begin VB.Frame Frame2 
      Caption         =   "文字"
      Height          =   2775
      Left            =   120
      TabIndex        =   14
      Top             =   4320
      Width           =   6255
      Begin VB.TextBox Text12 
         Height          =   270
         Left            =   4560
         TabIndex        =   26
         Text            =   "4"
         Top             =   2280
         Width           =   1455
      End
      Begin VB.TextBox Text11 
         Height          =   270
         Left            =   4560
         TabIndex        =   25
         Text            =   "3"
         Top             =   1560
         Width           =   1455
      End
      Begin VB.TextBox Text10 
         Height          =   270
         Left            =   1200
         TabIndex        =   24
         Text            =   "3"
         Top             =   2280
         Width           =   1455
      End
      Begin VB.TextBox Text9 
         Height          =   270
         Left            =   1200
         TabIndex        =   23
         Text            =   "23"
         Top             =   1560
         Width           =   1455
      End
      Begin VB.TextBox Text8 
         Height          =   270
         Left            =   1200
         TabIndex        =   22
         Text            =   "123 345445454 45454"
         Top             =   960
         Width           =   4695
      End
      Begin VB.TextBox Text7 
         Height          =   270
         Left            =   1200
         TabIndex        =   21
         Text            =   "5"
         Top             =   360
         Width           =   1455
      End
      Begin VB.Label Label13 
         Caption         =   "垂直留白"
         Height          =   255
         Left            =   3360
         TabIndex        =   20
         Top             =   2280
         Width           =   735
      End
      Begin VB.Label Label12 
         Caption         =   "文字高度"
         Height          =   255
         Left            =   3360
         TabIndex        =   19
         Top             =   1560
         Width           =   735
      End
      Begin VB.Label Label11 
         Caption         =   "水平留白"
         Height          =   255
         Left            =   120
         TabIndex        =   18
         Top             =   2280
         Width           =   735
      End
      Begin VB.Label Label10 
         Caption         =   "字体大小"
         Height          =   255
         Left            =   120
         TabIndex        =   17
         Top             =   1560
         Width           =   735
      End
      Begin VB.Label Label9 
         Caption         =   "文字信息"
         Height          =   255
         Left            =   0
         TabIndex        =   16
         Top             =   960
         Width           =   735
      End
      Begin VB.Label Label8 
         Caption         =   "每行字数"
         Height          =   255
         Left            =   120
         TabIndex        =   15
         Top             =   360
         Width           =   735
      End
   End
   Begin VB.Frame Frame1 
      Height          =   3855
      Left            =   120
      TabIndex        =   1
      Top             =   240
      Width           =   6135
      Begin VB.TextBox Text6 
         Height          =   270
         Left            =   3120
         TabIndex        =   13
         Text            =   "44"
         Top             =   720
         Width           =   735
      End
      Begin VB.TextBox Text5 
         Height          =   270
         Left            =   960
         TabIndex        =   10
         Text            =   "5"
         Top             =   720
         Width           =   735
      End
      Begin VB.TextBox Text4 
         Height          =   285
         Left            =   5040
         TabIndex        =   8
         Text            =   "3"
         Top             =   240
         Width           =   735
      End
      Begin VB.TextBox Text3 
         Height          =   285
         Left            =   3120
         TabIndex        =   6
         Text            =   "3"
         Top             =   240
         Width           =   735
      End
      Begin VB.TextBox Text2 
         Height          =   285
         Left            =   960
         TabIndex        =   4
         Text            =   "3"
         Top             =   240
         Width           =   735
      End
      Begin VB.TextBox Text1 
         Height          =   1845
         Left            =   120
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   2
         Text            =   "Form1.frx":0000
         Top             =   1440
         Width           =   2895
      End
      Begin VB.Label Label1 
         Caption         =   "条码"
         Height          =   255
         Left            =   3240
         TabIndex        =   29
         Top             =   1200
         Width           =   495
      End
      Begin VB.Image Image2 
         Height          =   1815
         Left            =   3240
         Top             =   1440
         Width           =   2535
      End
      Begin VB.Label Label7 
         Caption         =   "高度"
         Height          =   255
         Left            =   2040
         TabIndex        =   12
         Top             =   720
         Width           =   495
      End
      Begin VB.Label Label6 
         Caption         =   "颜色"
         Height          =   255
         Left            =   120
         TabIndex        =   11
         Top             =   720
         Width           =   495
      End
      Begin VB.Label Label5 
         Caption         =   "长宽比"
         Height          =   255
         Left            =   4200
         TabIndex        =   9
         Top             =   240
         Width           =   615
      End
      Begin VB.Label Label4 
         Caption         =   "纠错等级"
         Height          =   255
         Left            =   1920
         TabIndex        =   7
         Top             =   240
         Width           =   855
      End
      Begin VB.Label Label3 
         Caption         =   "条码列数"
         Height          =   255
         Left            =   120
         TabIndex        =   5
         Top             =   240
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "数据"
         Height          =   255
         Left            =   240
         TabIndex        =   3
         Top             =   1200
         Width           =   495
      End
   End
   Begin VB.CommandButton Command1 
      Caption         =   "从编辑栏生成"
      Height          =   375
      Left            =   360
      Picture         =   "Form1.frx":000D
      TabIndex        =   0
      Top             =   7320
      Width           =   1455
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Sub SetColorDepth Lib "MakePDF417.dll" _
(nDepth As Long)
Private Declare Sub GetColorDepth Lib "MakePDF417.dll" ()
Private Declare Sub MixText Lib "MakePDF417.dll" _
(ByVal szSrcBmpFileName As String, ByVal szDstBmpFileName As String, ByVal szText As String, ByVal lFontSize As Long, ByVal lTxtHeight As Long, ByVal lHmargin As Long, ByVal lVmargin As Long, ByVal lTxtCntOneLine As Long)
Private Declare Sub Make Lib "MakePDF417.dll" _
(ucData As Byte, ByVal nLen As Long, ByVal szFileName As String, ByVal nClumn As Long, ByVal nErr As Long, ByVal nHLRatio As Long, ByVal nHeight As Long)
Private Sub Command1_Click()
Dim a() As Byte
a = StrConv(Text1.Text, vbFromUnicode)
Make a(0), UBound(a) - LBound(a) + 1, "abc.bmp", CLng(Text2.Text), CLng(Text3.Text), CLng(Text4.Text), CLng(Text6.Text)
SetColorDepth (Text5.Text)
MixText "abc.bmp", "abc.bmp", Text8.Text, CLng(Text9.Text), CLng(Text11.Text), CLng(Text10.Text), CLng(Text12.Text), CLng(Text7.Text)
GetColorDepth
Image2.Picture = LoadPicture("abc.bmp")
End Sub

Private Sub Command2_Click()
CommonDialog1.Action = 1
FileName = CommonDialog1.FileName
If FileName = "" Then
Exit Sub
End If
Dim a() As Byte
a = StrConv(FileName, vbFromUnicode)
Make a(0), UBound(a) - LBound(a) + 1, "abc.bmp", CLng(Text2.Text), CLng(Text3.Text), CLng(Text4.Text), CLng(Text6.Text)
SetColorDepth (Text5.Text)
MixText "abc.bmp", "abc.bmp", Text8.Text, CLng(Text9.Text), CLng(Text11.Text), CLng(Text10.Text), CLng(Text12.Text), CLng(Text7.Text)
GetColorDepth
Image2.Picture = LoadPicture("abc.bmp")
End Sub

Private Sub Command3_Click()
CommonDialog1.InitDir = ""
CommonDialog1.Filter = "位图文件 (*.bmp)|*.bmp|所有文件 (*.*)|*.*||"
CommonDialog1.FileName = "twobarcode.bmp"
CommonDialog1.ShowSave
Open CommonDialog1.FileName For Output As #1
Print #1, Image
Close 1

End Sub
