資源簡(jiǎn)介
wince5.0 下用C#寫的藍(lán)牙打印測(cè)試程序。程序使用MC3000手持和Zebra MZ220便攜式打印機(jī)測(cè)試通過(guò)。
程序是建立serialport對(duì)象,指定com口連接打印機(jī),界面上open打開(kāi)藍(lán)牙端口,close關(guān)閉藍(lán)牙端口
打印時(shí)向藍(lán)牙端口發(fā)送czpl腳本內(nèi)容,內(nèi)有簡(jiǎn)單的czpl注釋。
注:如已建立藍(lán)牙打印機(jī)的Favorite,一定要使用這個(gè)Favorite指定的com口,否則wince會(huì)死掉
建議字體配置:FontSize:3 FontHeight:22
信息位置:5 700
一維位置:150 400
二維位置:270 600 其他可不變
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
namespace?BarTest
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????try
????????????{
????????????????InitializeComponent();
????????????????//serialPort1.PortName?=?“COM4“;
????????????????//serialPort1.Open();
????????????}
????????????catch(Exception?ee)
????????????{
????????????????string?strError?=?ee.Message?+?“??“?+?ee.ToString();
????????????????MessageBox.Show(strError);
????????????}
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????}
????????private?void?Form1_Closing(object?sender?CancelEventArgs?e)
????????{
????????????serialPort1.Close();
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????try
????????????{
????????????????string?strInfo?=?““;
????????????????if(checkBox1.Checked?==?true)
????????????????{
????????????????????strInfo?=?“!?0?200?200?320?1“;
????????????????????serialPort1.WriteLine(strInfo);
????????????????????strInfo?=?“PW?719“;
????????????????????serialPort1.WriteLine(strInfo);
????????????????????strInfo?=?“TONE?0“;
????????????????????serialPort1.WriteLine(strInfo);
????????????????????strInfo?=?“SPEED?3“;
????????????????????serialPort1.WriteLine(strInfo);
????????????????????strInfo?=?“ON-FEED?IGNORE“;
????????????????????serialPort1.WriteLine(strInfo);
????????????????????strInfo?=?“NO-PACE“;
????????????????????serialPort1.WriteLine(strInfo);
????????????????????strInfo?=?“JOURNAL“;
????????????????????serialPort1.WriteLine(strInfo);
????????????????????strInfo?=?“T90?0?5?10?707?????“+textBox_Descript.Text;
????????????????????serialPort1.WriteLine(strInfo);
????????????????????strInfo?=?“BT?7?0?0“;
????????????????????serialPort1.WriteLine(strInfo);
????????????????????strInfo?=?“VB?128?1?30?75?85?296?“+textBox_Code128.Text;
????????????????????serialPort1.WriteLine(strInfo);
????????????????????strInfo?=?“VB?PDF-417?215?702?XD?8?YD?17?C?0?S?0?“+textBox_PDF417.Text;
????????????????????serialPort1.WriteLine(strInfo);
????????????????????strInfo?=?“ENDPDF“;
????????????????????serialPort1.WriteLine(strInfo);
????????????????????strInfo?=?“PRINT“;
????????????????????serialPort1.WriteLine(strInfo);
????????????????}
????????????????else
????????????????{
????????????????????//strInfo?=?“!?0?200?200?609?1?PW?384?TONE?0?SPEED?3?ON-FEED?IGNORE?NO-PACE?JOURNAL?T?0?5?77?92?1234?BT?7?0?6?B?128?3?30?160?60?201?2133?PRINT“;
????????????????????//serialPort1.WriteLine(strInfo);
????????????????????int?PosX_Descrpt?=?Convert.ToInt32(textBox_DescX.Text);
????????????????????int?PosY_Descrpt?=?Convert.ToInt32(textBox_DescY.Text);
????????????????????int?iFontHeight?=?Convert.ToInt32(textBox_FontHeight.Text);
????????????????????//基本設(shè)置???PW?368為設(shè)置頁(yè)寬,368應(yīng)該
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????4066??2010-06-10?16:19??BarTest\BarTest\BarTest.csproj
?????文件????????198??2010-06-10?16:18??BarTest\BarTest\BarTest.csproj.user
?????文件??????13312??2010-06-13?10:44??BarTest\BarTest\bin\Debug\BarTest.exe
?????文件??????26112??2010-06-13?10:44??BarTest\BarTest\bin\Debug\BarTest.pdb
?????文件???????6703??2010-06-13?10:44??BarTest\BarTest\Form1.cs
?????文件??????15535??2010-06-12?14:26??BarTest\BarTest\Form1.Designer.cs
?????文件???????6300??2010-06-12?14:26??BarTest\BarTest\Form1.resx
?????文件????????268??2010-06-13?10:44??BarTest\BarTest\obj\BarTest.csproj.FileList.txt
?????文件????????842??2010-06-12?14:26??BarTest\BarTest\obj\Debug\BarTest.csproj.GenerateResource.Cache
?????文件??????13312??2010-06-13?10:44??BarTest\BarTest\obj\Debug\BarTest.exe
?????文件????????180??2010-06-12?14:26??BarTest\BarTest\obj\Debug\BarTest.Form1.resources
?????文件??????26112??2010-06-13?10:44??BarTest\BarTest\obj\Debug\BarTest.pdb
?????文件????????180??2010-06-10?16:19??BarTest\BarTest\obj\Debug\BarTest.Properties.Resources.resources
?????文件???????5101??2010-06-10?17:33??BarTest\BarTest\obj\Debug\ResolveAssemblyReference.cache
?????文件????????363??2010-06-10?16:18??BarTest\BarTest\Program.cs
?????文件???????1244??2010-06-10?16:18??BarTest\BarTest\Properties\AssemblyInfo.cs
?????文件???????2350??2010-06-10?16:18??BarTest\BarTest\Properties\Resources.Designer.cs
?????文件???????5618??2010-06-10?16:18??BarTest\BarTest\Properties\Resources.resx
?????文件???????1076??2010-06-10?16:18??BarTest\BarTest.sln
????..A..H.?????15360??2010-06-12?17:41??BarTest\BarTest.suo
?????目錄??????????0??2010-06-10?17:31??BarTest\BarTest\obj\Debug\Refactor
?????目錄??????????0??2010-06-10?16:18??BarTest\BarTest\obj\Debug\TempPE
?????目錄??????????0??2010-06-10?16:19??BarTest\BarTest\bin\Debug
?????目錄??????????0??2010-06-13?10:44??BarTest\BarTest\obj\Debug
?????目錄??????????0??2010-06-10?16:18??BarTest\BarTest\bin
?????目錄??????????0??2010-06-10?16:19??BarTest\BarTest\obj
?????目錄??????????0??2010-06-10?16:18??BarTest\BarTest\Properties
?????目錄??????????0??2010-06-13?10:44??BarTest\BarTest
?????目錄??????????0??2010-06-10?16:18??BarTest
-----------?---------??----------?-----??----
............此處省略2個(gè)文件信息
評(píng)論
共有 條評(píng)論