codesoft在delphi,C#中的例子

LabelView Sample:

private void Form1_Load(object sender, System.EventArgs e)
{
LabelApp=new LabelApplicationClass();
doc=(LabelView.LabelDocument)LabelApp.ActiveDocument();
doc.Open("c:workloglabel.lbl",true);
}

private void PrintLabel(string result)
{
try
{

LabelView.LabelField snLabel=(LabelView.LabelField)((LabelView.LabelFields)doc.LabelFields).Item("SN");
snLabel.Value=result;
doc.LabelSetup();
doc.PrintLabel(2,null,null,null,null,null,null);


}
catch(Exception err)
{
MessageBox.Show(err.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}




private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
LabelApp.Quit();
LabelApp = null;
System.GC.Collect();

}

Zebra-ZPL Sample:
先用Bar-One做成Barcode文檔,再通過File--&gtDown formatter to print生成zpl文檔,通過編程對zpl文檔中特定數據進行替換,最後輸出到指定端口即可.
ofstream fout; //declare file-stream handle
fout.open("lpt1:", ios::out); //open out to lpt1:
fout< fout< fout< fout< fout< fout< fout< fout< fout< fout< fout< fout< fout< fout< fout< fout.close();


///Codesoft Delphi
Var
BarApp,BarDoc:Variant;
Begin
BarApp := CreateOleObject('lppx.Application');
BarApp.Visible:=True;
BarDoc:=BarApp.ActiveDocument;
BarVars:=BarDoc.Variables;
BarDoc.Open('T018S1.Lab');
BarDoc.Variables.Item('Data1').Value:='ABCD';
BarDoc.Variables.Item('Data2').Value:='111';
BarDoc.Variables.Item('Data3').Value:='111ABCD';
Bardoc.Printlabel(1);
BarDoc.FormFeed;
Bardoc.Close;
BarApp.Quit;
End;

///Codesoft C#
using LabelManager2;
ApplicationClass lbl = new ApplicationClass();
try
{
lbl.Documents.Open(@"D:TempTEMP.Lab", false);
Document doc = lbl.ActiveDocument;
//foreach(...)
//{
doc.Variables.FormVariables.Item("Var0").Value = "12399999";
//doc.Variables.FreeVariables
//doc.Variables.Formulas
//doc.Variables.TableLookups
//doc.Variables.DatabaseVariables
//doc.Variables.Dates
//doc.Variables.Counters
doc.PrintDocument(1);
//}
doc.Close(false);
}
catch (Exception ex)
{
lbl.Quit();
}

SAMPLE CODESOFT 8 APPLICATIONS

Click a link below to download a sample ActiveX application:

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/93029/viewspace-1027377/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/93029/viewspace-1027377/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值