��
 
 
   
��
       Barcode Technology Online  

Asp.Net Barcode Control Demo Source Code


<%@ Import Namespace ="System.Drawing"%>
<%@ Register TagPrefix="cc1" Namespace="EaseSoftBarcode" Assembly="EaseWebControl" %>
<html>
<script language="C#" runat="server">

void CreateBarcodeBtn_Click(Object Src, EventArgs E) {

int fontsize=10;
EaseSoftBarcode.Symbology symbology ;
EaseSoftBarcode.Rotation rotation;
EaseSoftBarcode.ImageType imageformat;
switch( DropDownList_Imageformat.SelectedIndex)
{
case 0: imageformat = EaseSoftBarcode.ImageType.Bmp;break;
case 1: imageformat= EaseSoftBarcode.ImageType.Gif;break;
case 2: imageformat= EaseSoftBarcode.ImageType.Jpeg;break;
case 3: imageformat = EaseSoftBarcode.ImageType.Png;break;
default:imageformat= EaseSoftBarcode.ImageType.Png;break;
}

switch( DropDownList_Rotation.SelectedIndex)
{
case 0: rotation = EaseSoftBarcode.Rotation.Clockwise_Zero_Degree;break;
case 1: rotation = EaseSoftBarcode.Rotation.Clockwise_90_Degree;break;
case 2: rotation = EaseSoftBarcode.Rotation.Clockwise_180_Degree;break;
case 3: rotation = EaseSoftBarcode.Rotation.Clockwise_270_Degree;break;
default:rotation = EaseSoftBarcode.Rotation.Clockwise_Zero_Degree;break;
}

switch( DropDownList_Symbology.SelectedIndex)
{
case 0: symbology= EaseSoftBarcode.Symbology.Code39;break;
case 1: symbology= EaseSoftBarcode.Symbology.Code39ASCII;break;
case 2: symbology= EaseSoftBarcode.Symbology.Code93;break;
case 3: symbology= EaseSoftBarcode.Symbology.UPCA;break;
case 4: symbology= EaseSoftBarcode.Symbology.EAN13;break;
case 5: symbology= EaseSoftBarcode.Symbology.EAN8;break;
case 6: symbology= EaseSoftBarcode.Symbology.UPCE;break;
case 7: symbology= EaseSoftBarcode.Symbology.BookLand;break;
case 8: symbology= EaseSoftBarcode.Symbology.Code128;break;
case 9: symbology= EaseSoftBarcode.Symbology.UCC128;break;
case 10: symbology= EaseSoftBarcode.Symbology.Code25;break;
case 11: symbology= EaseSoftBarcode.Symbology.I25;break;
case 12: symbology= EaseSoftBarcode.Symbology.Code11;break;
case 13: symbology= EaseSoftBarcode.Symbology.Codabar;break;
case 14: symbology= EaseSoftBarcode.Symbology.MSI;break;
case 15: symbology= EaseSoftBarcode.Symbology.PDF417;break;
default: symbology= EaseSoftBarcode.Symbology.Code39;break;
}
try
{
fontsize= Convert.ToInt32(TextBox_Fontsize.Text);
EaseWebControl1.Font=new Font(DropDownList_Fontname.SelectedItem.Text,fontsize);
EaseWebControl1.Ratio=Convert.ToInt32(TextBox_Ratio.Text);
EaseWebControl1.Height=Convert.ToInt32(TextBox_Height.Text);
EaseWebControl1.Width=Convert.ToInt32(TextBox_Width.Text);
EaseWebControl1.BarHeight=Convert.ToInt32(TextBox_Barheight.Text);
EaseWebControl1.NarrowBarWidth=Convert.ToInt32(TextBox_Narrowbarwidth.Text);
EaseWebControl1.TopMargin=Convert.ToInt32(TextBox_Topmargin.Text);
EaseWebControl1.LeftMargin=Convert.ToInt32(TextBox_Leftmargin.Text);
EaseWebControl1.TextMargin=Convert.ToInt32(TextBox_Textmargin.Text);
}
catch{};
EaseWebControl1.ImageType=imageformat;
EaseWebControl1.SymbologyID= symbology;
EaseWebControl1.TextToEncode= TextBox_Text.Text;
EaseWebControl1.ForeColor= Color.FromName(DropDownList_Forecolor.SelectedItem.Text);
EaseWebControl1.BackColor= Color.FromName(DropDownList_Backcolor.SelectedItem.Text);
EaseWebControl1.ShowText= (DropDownList_Showtext.SelectedIndex==0);
EaseWebControl1.AddCheckDigit=(DropDownList_Checkdigit.SelectedIndex==0);
EaseWebControl1.AddCheckDigitToText=(DropDownList_Addcheckdigittotext.SelectedIndex==0);
EaseWebControl1.Rotation = rotation;
EaseWebControl1.TopComment = TextBox_Topcomment.Text;
}
</script>


<head>
<title>EaseSoft ASP.NET Barcode Web Server Control Demo</title>
<body bgcolor="white" lang="EN-US" link="#0000ee" vlink="#0000ee" alink="#0000ee">
<h1 align="center"><font face="Times New Roman, Times, serif" color="#000000">EaseSoft
Asp.Net Barcode Web Server Control Demo</font></h1>
<form action="demo2.aspx" runat=server>
<table borderColor="#999999" width="100%" height="600" cellSpacing="0" cellPadding="2" bgColor="#9ccbef" border="1">
<tr>
<td width="80%">
<table borderColor="#999999" width="100%" height="600" cellSpacing="0" cellPadding="2"
bgColor="#9ccbef" border="1">
<tr>
<td colSpan="4" height="176">
<table borderColor="gainsboro" height="162" cellSpacing="0" cellPadding="2" width="100%"
border="0">
<tr>
<td height="167">
<div align="center">
<cc1:EaseWebControl id="EaseWebControl1" runat="server" ></cc1:EaseWebControl>&nbsp;
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="116">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">Symbology</font></P>
</td>
<td style="WIDTH: 221px" width="90">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:dropdownlist id="DropDownList_Symbology" runat="server" Width="156px">
<asp:ListItem Value="0">Code 39</asp:ListItem>
<asp:ListItem Value="1">Code
39 FULL ASCII</asp:ListItem>
<asp:ListItem Value="2">Code
93</asp:ListItem>
<asp:ListItem Value="3" Selected="True">UPC
A</asp:ListItem>
<asp:ListItem Value="4">EAN 13</asp:ListItem>
<asp:ListItem Value="5">EAN 8</asp:ListItem>
<asp:ListItem Value="6">UPC
E</asp:ListItem>
<asp:ListItem Value="7">BOOKLAND</asp:ListItem>
<asp:ListItem Value="8">CODE 128</asp:ListItem>
<asp:ListItem Value="9">UCC/EAN
128</asp:ListItem>
<asp:ListItem Value="10">INDUSTRIAL 2 OF
5</asp:ListItem>
<asp:ListItem Value="11">INTERLEAVED 2 OF
5</asp:ListItem>
<asp:ListItem Value="12">CODE 11</asp:ListItem>
<asp:ListItem Value="13">CODABAR</asp:ListItem>
<asp:ListItem Value="14">MSI-PLESSEY</asp:ListItem>
<asp:ListItem Value="20">PDF417</asp:ListItem>
</asp:dropdownlist></font></P>
</td>
<td width="104">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">FontName</font></P>
</td>
<td>
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:dropdownlist id="DropDownList_Fontname" runat="server" Width="156px">
<asp:ListItem Value="Times New Roman" Selected="True">Times
New Roman</asp:ListItem>
<asp:ListItem Value="Arial">Arial</asp:ListItem>
<asp:ListItem Value="Verdana">Verdana</asp:ListItem>
</asp:dropdownlist></font></P>
</td>
</tr>
<tr>
<td width="116">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">Text</font></P>
</td>
<td style="WIDTH: 221px" width="90">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:textbox id="TextBox_Text" runat="server">12345678901,12345</asp:textbox></font></P>
</td>
<td width="104">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">FoneSize</font></P>
</td>
<td>
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:textbox id="TextBox_Fontsize" runat="server">10</asp:textbox></font></P>
</td>
</tr>
<tr>
<td width="116">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">Height</font></P>
</td>
<td style="WIDTH: 221px" width="90">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:textbox id="TextBox_Height" runat="server">150</asp:textbox></font></P>
</td>
<td width="104">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">Ratio</font></P>
</td>
<td>
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:textbox id="TextBox_Ratio" runat="server">3</asp:textbox></font></P>
</td>
</tr>
<tr>
<td width="116">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">Width</font></P>
</td>
<td style="WIDTH: 221px" width="90">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:textbox id="TextBox_Width" runat="server">260</asp:textbox></font></P>
</td>
<td width="104">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">AddCheckDigit</font></P>
</td>
<td>
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:dropdownlist id="DropDownList_Checkdigit" runat="server" Width="156px">
<asp:ListItem Value="True" Selected="True">True</asp:ListItem>
<asp:ListItem Value="False">False</asp:ListItem>
</asp:dropdownlist></font></P>
</td>
</tr>
<tr>
<td width="116">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">BarHeight</font></P>
</td>
<td style="WIDTH: 221px" width="90">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:textbox id="TextBox_Barheight" runat="server">1000</asp:textbox></font></P>
</td>
<td width="104">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;Top Margin</font></P>
</td>
<td>
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:textbox id="TextBox_Topmargin" runat="server">200</asp:textbox></font></P>
</td>
</tr>
<tr>
<td width="116">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">NarrowbarWidth</font></P>
</td>
<td style="WIDTH: 221px" width="90">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:textbox id="TextBox_Narrowbarwidth" runat="server">10</asp:textbox></font></P>
</td>
<td width="104">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;Left Margin</font></P>
</td>
<td>
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:textbox id="TextBox_Leftmargin" runat="server">200</asp:textbox></font></P>
</td>
</tr>
<tr>
<td width="116">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">ForeColor</font></P>
</td>
<td style="WIDTH: 221px" width="90">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:dropdownlist id="DropDownList_Forecolor" runat="server" Width="156px">
<asp:ListItem Value="black" Selected="True">black</asp:ListItem>
<asp:ListItem Value="blue">blue</asp:ListItem>
<asp:ListItem Value="red">red</asp:ListItem>
<asp:ListItem Value="white">white</asp:ListItem>
<asp:ListItem Value="yellow">yellow</asp:ListItem>
<asp:ListItem Value="gray">gray</asp:ListItem>
<asp:ListItem Value="green">green</asp:ListItem>
</asp:dropdownlist></font></P>
</td>
<td width="104">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;Text Margin</font></P>
</td>
<td>
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:textbox id="TextBox_Textmargin" runat="server">0</asp:textbox></font></P>
</td>
</tr>
<tr>
<td width="116">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">BackColor</font></P>
</td>
<td style="WIDTH: 221px" width="90">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:dropdownlist id="DropDownList_Backcolor" runat="server" Width="156px">
<asp:ListItem Value="white" Selected="True">white</asp:ListItem>
<asp:ListItem Value="yellow">yellow</asp:ListItem>
<asp:ListItem Value="black">black</asp:ListItem>
<asp:ListItem Value="red">red</asp:ListItem>
<asp:ListItem Value="blue">blue</asp:ListItem>
<asp:ListItem Value="green">green</asp:ListItem>
<asp:ListItem Value="gray">gray</asp:ListItem>
</asp:dropdownlist></font></P>
</td>
<td width="104">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">AddCheckDigitToText</font></P>
</td>
<td>
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2"><asp:dropdownlist id="DropDownList_Addcheckdigittotext" runat="server" Width="156px">
<asp:ListItem Value="0" Selected="True">True</asp:ListItem>
<asp:ListItem Value="1">False</asp:ListItem>
</asp:dropdownlist></font></P>
</td>
</tr>
<tr>
<td width="116">
<p align="center"><font face="Arial, Helvetica, sans-serif" size="2">TopComment</font></p>
</td>
<td style="WIDTH: 221px" width="90">
<p align="center"><font face="Arial, Helvetica, sans-serif"><font face="Arial, Helvetica, sans-serif"><font size="2"><font size="2"><asp:textbox id="TextBox_Topcomment" runat="server" Width="147px">ASP.NET CONTROL DEMO</asp:textbox></font></font></font></font></p>
</td>
<td width="104">
<p align="center"><font face="Arial, Helvetica, sans-serif" size="2">ImageFormat</font></p>
</td>
<td>
<p align="center"><font face="Arial, Helvetica, sans-serif"><font face="Arial, Helvetica, sans-serif"><font size="2"><font size="2">
<asp:DropDownList id="DropDownList_Imageformat" runat="server" Width="158px">
<asp:ListItem Value="0">Bmp</asp:ListItem>
<asp:ListItem Value="1">Gif</asp:ListItem>
<asp:ListItem Value="2" Selected="True">Jpeg</asp:ListItem>
<asp:ListItem Value="3">Png</asp:ListItem>
</asp:DropDownList></font></font></font></font></p>
</td>
</tr>
<tr>
<td width="116">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">ShowText</font></P>
</td>
<td style="WIDTH: 221px" width="90">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
<asp:dropdownlist id="DropDownList_Showtext" runat="server" Width="156px">
<asp:ListItem Value="True" Selected="True">True</asp:ListItem>
<asp:ListItem Value="False">False</asp:ListItem>
</asp:dropdownlist></font></P>
</td>
<td width="104">
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2">Rotation</font></P>
</td>
<td>
<P align="center"><font face="Arial, Helvetica, sans-serif" size="2"><asp:dropdownlist id="DropDownList_Rotation" runat="server" Width="156px">
<asp:ListItem Value="0" Selected="True">Rotat 0 Degree</asp:ListItem>
<asp:ListItem Value="1">Rotate 90 Degree</asp:ListItem>
<asp:ListItem Value="2">Rotate
180 Degree</asp:ListItem>
<asp:ListItem Value="3">Rotate 270
Degree</asp:ListItem>
</asp:dropdownlist></font></P>
</td>
</tr>
<tr>
<td colSpan="4" height="71"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp; </font>
<div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><asp:button id="Button_Createbarcode" OnClick="CreateBarcodeBtn_Click" runat="server" Text="Create Barcode"></asp:button></font></div>
</td>
</tr>
</table>
</td>

</tr>
</table>


<p>&nbsp;</p>
</form>
<h1 align="center">&nbsp;</h1>
</body>
</html>


 
© 200-2009 EaseSoft Inc. All Rights Reserved.Terms of Use | Privacy Statement