原創|使用教程|編輯:龔雪|2015-11-05 17:32:27.000|閱讀 745 次
概述:本教程是關于在Barcode Professional中,如何讓條碼顯示在HTML頁面上,文中以C#和VB代碼為例。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
有時候我們需要在HTML頁面上顯示條碼。今天給大家分享在Barcode Professional中,如何將在HTML上顯示條碼。
【Barcode Professional for ASP.NET下載】
步驟:
VB
Imports Neodynamic.WebControls.BarcodeProfessional
C#
using Neodynamic.WebControls.BarcodeProfessional;
VB
Dim bcp As New BarcodeProfessional bcp.Code = Request.QueryString("code") bcp.Symbology = Symbology.Code128 Dim barcodeImage As Byte() = bcp.GetBarcodeImage(System.Drawing.Imaging.ImageFormat.Gif) If (barcodeImage Is Nothing) Then Response.End() Else Response.Clear() Response.ContentType = "image/gif" Response.BinaryWrite(barcodeImage) Response.End() End If
C#
BarcodeProfessional bcp = new BarcodeProfessional(); bcp.Code = Request.QueryString["code"]; bcp.Symbology = Symbology.Code128; byte[] barcodeImage = bcp.GetBarcodeImage(System.Drawing.Imaging.ImageFormat.Gif); if(barcodeImage == null) Response.End(); else { Response.Clear(); Response.ContentType = "image/gif"; Response.BinaryWrite(barcodeImage); Response.End(); }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Barcode Professional in a HTML Page</title> <script type="text/javascript"> function ChangeBarcode(code) { var elem = document.getElementById("imgBarcode"); if(elem!=null) elem.src="BarcodeGen.aspx?code="+code; } </script> </head> <body> <P> <FONT face="Arial"><b>Barcode Professional in a HTML page</b></FONT> </P> <P> <IMG id="imgBarcode" alt="" src="BarcodeGen.aspx?code=12300445"> </P> <P> <FONT face="Arial" size="2">Enter a value to encode:</FONT><BR> <INPUT id="Text1" type="text" name="Text1"> <INPUT id="Button1" type="button" value="View Barcode" name="Button1" onclick="ChangeBarcode(Text1.value)"> </P> </body> </html>
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn