Option Strict Off
Option Explicit On
Friend Class Form1
	Inherits System.Windows.Forms.Form
#Region "Windows 窗体设计器生成的代码"
	Public Sub New()
		MyBase.New()
		If m_vb6FormDefInstance Is Nothing Then
			If m_InitializingDefInstance Then
				m_vb6FormDefInstance = Me
			Else
				Try 
					'对于启动窗体，所创建的第一个实例为默认实例。
					If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
						m_vb6FormDefInstance = Me
					End If
				Catch
				End Try
			End If
		End If
		'此调用是 Windows 窗体设计器所必需的。
		InitializeComponent()
	End Sub
	'窗体重写处置，以清理组件列表。
	Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
		If Disposing Then
			If Not components Is Nothing Then
				components.Dispose()
			End If
		End If
		MyBase.Dispose(Disposing)
	End Sub
	'Windows 窗体设计器所必需的
	Private components As System.ComponentModel.IContainer
	Public ToolTip1 As System.Windows.Forms.ToolTip
	Public WithEvents Command1 As System.Windows.Forms.Button
	Public WithEvents Label1 As System.Windows.Forms.Label
	'注意: 以下过程是 Windows 窗体设计器所必需的
	'可以使用 Windows 窗体设计器来修改它。
	'不要使用代码编辑器修改它。
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
		Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
		Me.components = New System.ComponentModel.Container()
		Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
		Me.ToolTip1.Active = True
		Me.Command1 = New System.Windows.Forms.Button
		Me.Label1 = New System.Windows.Forms.Label
		Me.Text = "POSTEK PRINTER"
		Me.ClientSize = New System.Drawing.Size(440, 346)
		Me.Location = New System.Drawing.Point(4, 23)
		Me.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultLocation
		Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
		Me.BackColor = System.Drawing.SystemColors.Control
		Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable
		Me.ControlBox = True
		Me.Enabled = True
		Me.KeyPreview = False
		Me.MaximizeBox = True
		Me.MinimizeBox = True
		Me.Cursor = System.Windows.Forms.Cursors.Default
		Me.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.ShowInTaskbar = True
		Me.HelpButton = False
		Me.WindowState = System.Windows.Forms.FormWindowState.Normal
		Me.Name = "Form1"
		Me.Command1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
		Me.Command1.Text = "PRINT"
		Me.Command1.Size = New System.Drawing.Size(113, 25)
		Me.Command1.Location = New System.Drawing.Point(136, 168)
		Me.Command1.TabIndex = 1
		Me.Command1.BackColor = System.Drawing.SystemColors.Control
		Me.Command1.CausesValidation = True
		Me.Command1.Enabled = True
		Me.Command1.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Command1.Cursor = System.Windows.Forms.Cursors.Default
		Me.Command1.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Command1.TabStop = True
		Me.Command1.Name = "Command1"
		Me.Label1.Text = "ONLY TEST FOR POSTEK PRINTER"
		Me.Label1.Size = New System.Drawing.Size(185, 17)
		Me.Label1.Location = New System.Drawing.Point(104, 48)
		Me.Label1.TabIndex = 0
		Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopLeft
		Me.Label1.BackColor = System.Drawing.SystemColors.Control
		Me.Label1.Enabled = True
		Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label1.UseMnemonic = True
		Me.Label1.Visible = True
		Me.Label1.AutoSize = False
		Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.None
		Me.Label1.Name = "Label1"
		Me.Controls.Add(Command1)
		Me.Controls.Add(Label1)
	End Sub
#End Region 
#Region "升级支持"
	Private Shared m_vb6FormDefInstance As Form1
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As Form1
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New Form1()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
	Private Declare Function PTK_Getinfo Lib "CDFPSK.DLL" () As Short
	Private Declare Function PTK_SetPrintSpeed Lib "CDFPSK.DLL" (ByVal speed As Short) As Integer
	Private Declare Function PTK_SetDarkness Lib "CDFPSK.DLL" (ByVal darkness As Short) As Integer
	Private Declare Function PTK_DrawBarcode Lib "CDFPSK.DLL" (ByVal px As Integer, ByVal py As Integer, ByVal pdirec As Integer, ByVal typee As String, ByVal NarrowWidth As Integer, ByVal pHorizontal As Integer, ByVal pVertical As Integer, ByVal ptext As Byte, ByVal pstr As String) As Integer
    Private Declare Function OpenPort Lib "CDFPSK.DLL" (ByVal OP As Integer) As Integer
	Private Declare Sub ClosePort Lib "CDFPSK.DLL" ()
	Private Declare Function PTK_DrawTextTrueTypeW Lib "CDFPSK.DLL" (ByVal x As Integer, ByVal y As Integer, ByVal FHeight As Integer, ByVal FWidth As Integer, ByVal FType As String, ByVal Fspin As Integer, ByVal FWeight As Integer, ByVal FItalic As Integer, ByVal FUnline As Integer, ByVal FStrikeOut As Integer, ByVal id_name As String, ByVal data As String) As Integer
	Private Declare Function PTK_PcxGraphicsDel Lib "CDFPSK.DLL" (ByVal pid As String) As Integer
	Private Declare Function PTK_PcxGraphicsDownload Lib "CDFPSK.DLL" (ByVal pcxname As String, ByVal pcxpath As String) As Integer
	Private Declare Function PTK_PrintLabel Lib "CDFPSK.DLL" (ByVal number As Short, ByVal cpnumber As Short) As Integer
	Private Declare Function PTK_PrintPCX Lib "CDFPSK.DLL" (ByVal px As Short, ByVal py As Short, ByVal filename As String) As Integer
	Private Declare Function PTK_DrawPcxGraphics Lib "CDFPSK.DLL" (ByVal x As Integer, ByVal y As Integer, ByVal gname As String) As Integer
	Private Declare Function PTK_DrawLineOr Lib "CDFPSK.DLL" (ByVal px As Short, ByVal py As Short, ByVal plength As Short, ByVal pH As Short) As Integer
	Private Declare Function GetErrState Lib "CDFPSK.DLL" () As Short
	Private Declare Function PTK_SetLabelHeight Lib "CDFPSK.DLL" (ByVal lheight As Short, ByVal gapH As Short) As Short
	Private Declare Function PTK_SetLabelWidth Lib "CDFPSK.DLL" (ByVal lwidth As Short) As Short
	Private Declare Function SetPCComPort Lib "CDFPSK.DLL" (ByVal BaudRate As Short, ByVal HandShake As Boolean) As Short
    Private Declare Function PTK_RWRFIDLabel Lib "CDFPSK.DLL" (ByVal nRWMode As Short, ByVal nWForm As Short, ByVal nStartBlock As Short, ByVal nWDataNum As Short, ByVal nWArea As Short, ByVal pstr As String) As Integer
    Private Declare Function PTK_DrawText Lib "CDFPSK.DLL" (ByVal px As Short, ByVal py As Short, ByVal pdirec As Short, ByVal pFont As Short, ByVal pHorizontal As Short, ByVal pVertical As Short, ByVal ptext As Byte, ByVal pstr As String) As Integer

    Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
        Dim a As String
        OpenPort(1)
        PTK_SetDarkness(10)
        PTK_SetPrintSpeed(4)
        a = "123456789012345678901234567890"
        PTK_DrawBarcode(20, 10, 0, "1", 2, 2, 60, 66, a)
        PTK_RWRFIDLabel(1, 1, 0, 6, 3, "POSTEK")
        'PTK_PcxGraphicsDel "*"
        'PTK_PcxGraphicsDownload "aab", "F:\DLL FOR POSTEK\VB TEST\PHONE.PCX" '请更改为PHONE.PCX文件的当前路径
        'PTK_DrawPcxGraphics 400, 210, "aab"
        PTK_DrawLineOr(50, 180, 2, 100)
        PTK_DrawTextTrueTypeW(80, 50, 40, 0, "Arial", 1, 400, 0, 0, 0, "AB", "PosteK Printer")
        PTK_DrawText(100, 100, 0, 2, 1, 1, 78, "7777")

        PTK_PrintLabel(2, 1)
        ClosePort()
    End Sub
End Class