home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code1
/
bar_vbx
/
form1.frm
< prev
next >
Wrap
Text File
|
1993-12-22
|
7KB
|
268 lines
VERSION 2.00
Begin Form Form1
Caption = "BarCode/VBX Sample"
ClientHeight = 3336
ClientLeft = 900
ClientTop = 1920
ClientWidth = 5856
Height = 3756
Left = 852
LinkTopic = "Form1"
ScaleHeight = 3336
ScaleWidth = 5856
Top = 1548
Width = 5952
Begin BarCode BarCode2
BarCodeType = 0 'Code 3 of 9
Checksum = 0
Height = 672
Left = 4500
NarrowBarWidth = 2
Ratio = 0 '3:1
Rotation = 0 'Normal
Text = ""
Top = 600
Visible = 0 'False
Width = 1212
End
Begin CommandButton Command3
Caption = "P&rint Printer"
Height = 432
Left = 3720
TabIndex = 6
Top = 2760
Width = 1992
End
Begin CommandButton PrintFormBtn
Caption = "Print &Form"
Height = 432
Left = 1860
TabIndex = 5
Top = 2760
Width = 1752
End
Begin CommandButton Command2
Caption = "&Bound Sample..."
Height = 432
Left = 60
TabIndex = 4
Top = 2160
Width = 1692
End
Begin CommonDialog CMDialog1
CancelError = -1 'True
Left = 5280
PrinterDefault = 0 'False
Top = 60
End
Begin CommandButton Command1
Cancel = -1 'True
Caption = "&Cancel"
Height = 432
Left = 1860
TabIndex = 2
Top = 2160
Width = 1752
End
Begin BarCode BarCode1
BarCodeType = 0 'Code 3 of 9
Checksum = 0
Height = 672
Left = 180
NarrowBarWidth = 2
Ratio = 0 '3:1
Rotation = 0 'Normal
Text = ""
Top = 600
Width = 3456
End
Begin CommandButton Print
Caption = "&Print w/Selection"
Height = 432
Left = 60
TabIndex = 1
Top = 2760
Width = 1692
End
Begin TextBox Text1
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.6
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 360
Left = 120
TabIndex = 0
Text = "Text1"
Top = 180
Width = 3072
End
Begin Label Label1
Caption = "Double Click on BarCode to set Properties."
Height = 312
Left = 60
TabIndex = 3
Top = 1620
Width = 4332
End
End
Sub BarCode1_DblClick ()
Form2.Show 1
End Sub
Sub Command1_Click ()
End
End Sub
Sub Command2_Click ()
Form3.Show 1
End Sub
Sub Command3_Click ()
BarCode1.PrinterTop = 50
BarCode1.PrinterLeft = 0
BarCode1.PrinterHeight = 100
BarCode1.PrinterBarWidth = BarCode1.NarrowBarWidth * 2
BarCode1.PrinterHDC = Printer.hDC
If BarCodeGetLastErrorCode() <> False Then
MsgBox BarCodeGetLastErrorString()
End If
Printer.CurrentX = 0
Printer.CurrentY = 0
Printer.Print "Part Number";
Printer.CurrentX = 5000
Printer.Print "Serial Number";
BarCode1.PrinterLeft = 835
BarCode1.PrinterHDC = Printer.hDC
If BarCodeGetLastErrorCode() <> False Then
MsgBox BarCodeGetLastErrorString()
End If
Printer.NewPage
Printer.EndDoc
End Sub
Sub Form_Load ()
Text1.Text = "123456"
End Sub
Sub Print_Click ()
Dim DOCINFO As DOCINFO
Dim StopPrint As Integer
Dim OutStr As String
Dim hOldFont As Integer
Dim theScaleMode As Integer
StopPrint = False
On Error GoTo PrintErr:
CMDialog1.Flags = PD_RETURNDC Or PD_PRINTSETUP
CMDialog1.Action = 5
If StopPrint = False Then
Screen.MousePointer = 11
theScaleMode = 6 ' Millimeters
CreateObjects
DOCINFO.cbSize = 0
DOCINFO.DocName = 0
DOCINFO.Output = 0
Ok = StartDoc(CMDialog1.hDC, DOCINFO)
Ok = StartPage(CMDialog1.hDC)
hOldFont = SelectObject(CMDialog1.hDC, hTextFont)
PrintText CMDialog1.hDC, "Part Number (P)", 0, 0, hTextFont, theScaleMode
PrintText CMDialog1.hDC, "123-ABC", 0, 4, hDataFont, theScaleMode
BarCode2.BarCodeType = 0
BarCode2.Text = "P" & "123-ABC" & Chr(0)
BarCode2.PrinterTop = 13
BarCode2.PrinterLeft = 0
BarCode2.PrinterHeight = 12
BarCode2.PrinterBarWidth = 4
BarCode2.PrinterScaleMode = theScaleMode
BarCode2.PrinterHDC = CMDialog1.hDC
If BarCodeGetLastErrorCode() <> False Then
MsgBox BarCodeGetLastErrorString()
End If
PrintText CMDialog1.hDC, "Serial Number (S)", 85, 0, hTextFont, theScaleMode
PrintText CMDialog1.hDC, "987654", 85, 4, hDataFont, theScaleMode
BarCode2.BarCodeType = 0
BarCode2.Text = "S" & "987654" & Chr(0)
BarCode2.PrinterTop = 13
BarCode2.PrinterLeft = 85
BarCode2.PrinterHeight = 12
BarCode2.PrinterBarWidth = 4
BarCode2.PrinterHDC = CMDialog1.hDC
If BarCodeGetLastErrorCode() <> False Then
MsgBox BarCodeGetLastErrorString()
End If
PrintText CMDialog1.hDC, "P.O. Number (N)", 0, 30, hTextFont, theScaleMode
PrintText CMDialog1.hDC, "546789", 0, 34, hDataFont, theScaleMode
BarCode2.BarCodeType = 0
BarCode2.Text = "N" & "546789" & Chr(0)
BarCode2.PrinterTop = 42
BarCode2.PrinterLeft = 0
BarCode2.PrinterHeight = 12
BarCode2.PrinterBarWidth = 4
BarCode2.PrinterHDC = CMDialog1.hDC
If BarCodeGetLastErrorCode() <> False Then
MsgBox BarCodeGetLastErrorString()
End If
PrintText CMDialog1.hDC, "ABC Corporation", 85, 42, hCompanyFont, theScaleMode
PrintText CMDialog1.hDC, "123 Street Address", 85, 46, hCompanyFont, theScaleMode
PrintText CMDialog1.hDC, "Anywhere, USA", 85, 50, hCompanyFont, theScaleMode
Ok = SelectObject(CMDialog1.hDC, hPen)
MoveToScale CMDialog1.hDC, 80, 0, theScaleMode
LineToScale CMDialog1.hDC, 80, 55, theScaleMode
MoveToScale CMDialog1.hDC, 0, 28, theScaleMode
LineToScale CMDialog1.hDC, 155, 28, theScaleMode
Ok = EndPage(CMDialog1.hDC)
Ok = EndDocAPI(CMDialog1.hDC)
Ok = SelectObject(CMDialog1.hDC, hOldFont)
DeleteObjects
Ok = DeleteDC(CMDialog1.hDC)
Screen.MousePointer = 0
End If
On Error GoTo 0
Exit Sub
PrintErr:
StopPrint = True
Resume Next
End Sub
Sub PrintFormBtn_Click ()
Form4.PartNumber.Text = "123456"
Form4.PartBarCode.Text = "P" & Form4.PartNumber.Text
Form4.SerialNumber.Text = "230549"
Form4.SerialBarCode.Text = "S" & Form4.SerialNumber.Text
Form4.PONumber.Text = "345634-DF"
Form4.POBarCode.Text = "N" & Form4.PONumber.Text
Form4.PrintForm
End Sub
Sub Text1_Change ()
BarCode1.Text = Text1.Text
End Sub