��
 
 
   
��
       Barcode Technology Online  

.Net Windows Forms Control Demo Source Code


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Printing;
using EaseSoftBarcode;
using System.Drawing.Imaging;

namespace barcodesample
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.PrintPreviewDialog printPreviewDialog1;
private System.Drawing.Printing.PrintDocument printDocument1;
private System.Windows.Forms.Button button_save;
private System.Windows.Forms.Button button_printpreview;
private System.Windows.Forms.Button button_print;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button_Createbarcode;
private System.Windows.Forms.Label label_Symbology;
private System.Windows.Forms.Label label_Text;
private System.Windows.Forms.Label label_Imageheight;
private System.Windows.Forms.Label label_Imagewidth;
private System.Windows.Forms.Label label_Barheight;
private System.Windows.Forms.Label label_Narrowbarwidth;
private System.Windows.Forms.Label label_Forecolor;
private System.Windows.Forms.Label label_Fontname;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label_Topcommentleftmargin;
private System.Windows.Forms.Label label_Topcommenttopmargin;
private System.Windows.Forms.Label label_Barratio;
private System.Windows.Forms.Label label_Bartopmargin;
private System.Windows.Forms.Label label_Barleftmargin;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label Label_Showhrtext;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label_Addcheckditittotext;
private System.Windows.Forms.Label label_Rotation;
private System.Windows.Forms.ComboBox comboBox_Format;
private System.Windows.Forms.ComboBox comboBox_Symbology;
private System.Windows.Forms.TextBox textBox_Text;
private System.Windows.Forms.TextBox textBox_Height;
private System.Windows.Forms.TextBox textBox_Barheight;
private System.Windows.Forms.TextBox textBox_Narrowbarwidth;
private System.Windows.Forms.TextBox textBox_Width;
private System.Windows.Forms.ComboBox comboBox_Showtext;
private System.Windows.Forms.ComboBox comboBox_Addcheckdigit;
private System.Windows.Forms.ComboBox comboBox_Addcheckdigittotext;
private System.Windows.Forms.ComboBox comboBox_Rotation;
private System.Windows.Forms.TextBox textBox_Ratio;
private System.Windows.Forms.TextBox textBox_Topcomment;
private System.Windows.Forms.ComboBox comboBox_Forecolor;
private System.Windows.Forms.ComboBox comboBox_Fontname;
private System.Windows.Forms.TextBox textBox_Topcommentleftmargin;
private System.Windows.Forms.TextBox textBox_Topcommenttopmargin;
private System.Windows.Forms.TextBox textBox_Topmargin;
private System.Windows.Forms.TextBox textBox_Leftmargin;
private System.Windows.Forms.TextBox textBox_Textmargin;
private System.Windows.Forms.TextBox textBox_Fontsize;
private System.Windows.Forms.Label label_Backcolor;
private System.Windows.Forms.ComboBox comboBox_Backcolor;
private System.Windows.Forms.Label label_Resolution;
private System.Windows.Forms.TextBox textBox_Resolution;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox textBox_Path;
private EaseSoftBarcode.EaseWinControl easeWinControl1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.button_save = new System.Windows.Forms.Button();
this.button_printpreview = new System.Windows.Forms.Button();
this.button_print = new System.Windows.Forms.Button();
this.printPreviewDialog1 = new System.Windows.Forms.PrintPreviewDialog();
this.printDocument1 = new System.Drawing.Printing.PrintDocument();
this.button1 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox_Resolution = new System.Windows.Forms.TextBox();
this.label_Resolution = new System.Windows.Forms.Label();
this.comboBox_Backcolor = new System.Windows.Forms.ComboBox();
this.label_Backcolor = new System.Windows.Forms.Label();
this.textBox_Fontsize = new System.Windows.Forms.TextBox();
this.textBox_Width = new System.Windows.Forms.TextBox();
this.textBox_Textmargin = new System.Windows.Forms.TextBox();
this.textBox_Leftmargin = new System.Windows.Forms.TextBox();
this.textBox_Topmargin = new System.Windows.Forms.TextBox();
this.textBox_Topcommenttopmargin = new System.Windows.Forms.TextBox();
this.textBox_Topcommentleftmargin = new System.Windows.Forms.TextBox();
this.comboBox_Fontname = new System.Windows.Forms.ComboBox();
this.comboBox_Forecolor = new System.Windows.Forms.ComboBox();
this.textBox_Topcomment = new System.Windows.Forms.TextBox();
this.textBox_Ratio = new System.Windows.Forms.TextBox();
this.textBox_Narrowbarwidth = new System.Windows.Forms.TextBox();
this.textBox_Barheight = new System.Windows.Forms.TextBox();
this.textBox_Height = new System.Windows.Forms.TextBox();
this.textBox_Text = new System.Windows.Forms.TextBox();
this.comboBox_Rotation = new System.Windows.Forms.ComboBox();
this.comboBox_Addcheckdigittotext = new System.Windows.Forms.ComboBox();
this.comboBox_Addcheckdigit = new System.Windows.Forms.ComboBox();
this.comboBox_Showtext = new System.Windows.Forms.ComboBox();
this.comboBox_Symbology = new System.Windows.Forms.ComboBox();
this.label_Rotation = new System.Windows.Forms.Label();
this.label_Addcheckditittotext = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.Label_Showhrtext = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label_Barleftmargin = new System.Windows.Forms.Label();
this.label_Bartopmargin = new System.Windows.Forms.Label();
this.label_Barratio = new System.Windows.Forms.Label();
this.label_Topcommenttopmargin = new System.Windows.Forms.Label();
this.label_Topcommentleftmargin = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label_Fontname = new System.Windows.Forms.Label();
this.label_Forecolor = new System.Windows.Forms.Label();
this.label_Narrowbarwidth = new System.Windows.Forms.Label();
this.label_Barheight = new System.Windows.Forms.Label();
this.label_Imagewidth = new System.Windows.Forms.Label();
this.label_Imageheight = new System.Windows.Forms.Label();
this.label_Text = new System.Windows.Forms.Label();
this.label_Symbology = new System.Windows.Forms.Label();
this.button_Createbarcode = new System.Windows.Forms.Button();
this.textBox_Path = new System.Windows.Forms.TextBox();
this.comboBox_Format = new System.Windows.Forms.ComboBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.easeWinControl1 = new EaseSoftBarcode.EaseWinControl();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// button_save
//
this.button_save.Location = new System.Drawing.Point(232, 176);
this.button_save.Name = "button_save";
this.button_save.TabIndex = 1;
this.button_save.Text = "Save";
this.button_save.Click += new System.EventHandler(this.button_save_Click);
//
// button_printpreview
//
this.button_printpreview.Location = new System.Drawing.Point(336, 176);
this.button_printpreview.Name = "button_printpreview";
this.button_printpreview.Size = new System.Drawing.Size(88, 23);
this.button_printpreview.TabIndex = 2;
this.button_printpreview.Text = "PrintPreview";
this.button_printpreview.Click += new System.EventHandler(this.button_printpreview_Click);
//
// button_print
//
this.button_print.Location = new System.Drawing.Point(456, 176);
this.button_print.Name = "button_print";
this.button_print.TabIndex = 3;
this.button_print.Text = "Print";
this.button_print.Click += new System.EventHandler(this.button_print_Click);
//
// printPreviewDialog1
//
this.printPreviewDialog1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.ClientSize = new System.Drawing.Size(400, 300);
this.printPreviewDialog1.Enabled = true;
this.printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
this.printPreviewDialog1.Location = new System.Drawing.Point(110, 145);
this.printPreviewDialog1.MinimumSize = new System.Drawing.Size(375, 250);
this.printPreviewDialog1.Name = "printPreviewDialog1";
this.printPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty;
this.printPreviewDialog1.Visible = false;
//
// button1
//
this.button1.Location = new System.Drawing.Point(560, 176);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(120, 23);
this.button1.TabIndex = 5;
this.button1.Text = "Copy to Clipboard";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// groupBox1
//
this.groupBox1.BackColor = System.Drawing.SystemColors.InactiveCaption;
this.groupBox1.Controls.Add(this.textBox_Resolution);
this.groupBox1.Controls.Add(this.label_Resolution);
this.groupBox1.Controls.Add(this.comboBox_Backcolor);
this.groupBox1.Controls.Add(this.label_Backcolor);
this.groupBox1.Controls.Add(this.textBox_Fontsize);
this.groupBox1.Controls.Add(this.textBox_Width);
this.groupBox1.Controls.Add(this.textBox_Textmargin);
this.groupBox1.Controls.Add(this.textBox_Leftmargin);
this.groupBox1.Controls.Add(this.textBox_Topmargin);
this.groupBox1.Controls.Add(this.textBox_Topcommenttopmargin);
this.groupBox1.Controls.Add(this.textBox_Topcommentleftmargin);
this.groupBox1.Controls.Add(this.comboBox_Fontname);
this.groupBox1.Controls.Add(this.comboBox_Forecolor);
this.groupBox1.Controls.Add(this.textBox_Topcomment);
this.groupBox1.Controls.Add(this.textBox_Ratio);
this.groupBox1.Controls.Add(this.textBox_Narrowbarwidth);
this.groupBox1.Controls.Add(this.textBox_Barheight);
this.groupBox1.Controls.Add(this.textBox_Height);
this.groupBox1.Controls.Add(this.textBox_Text);
this.groupBox1.Controls.Add(this.comboBox_Rotation);
this.groupBox1.Controls.Add(this.comboBox_Addcheckdigittotext);
this.groupBox1.Controls.Add(this.comboBox_Addcheckdigit);
this.groupBox1.Controls.Add(this.comboBox_Showtext);
this.groupBox1.Controls.Add(this.comboBox_Symbology);
this.groupBox1.Controls.Add(this.label_Rotation);
this.groupBox1.Controls.Add(this.label_Addcheckditittotext);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.Label_Showhrtext);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label_Barleftmargin);
this.groupBox1.Controls.Add(this.label_Bartopmargin);
this.groupBox1.Controls.Add(this.label_Barratio);
this.groupBox1.Controls.Add(this.label_Topcommenttopmargin);
this.groupBox1.Controls.Add(this.label_Topcommentleftmargin);
this.groupBox1.Controls.Add(this.label10);
this.groupBox1.Controls.Add(this.label9);
this.groupBox1.Controls.Add(this.label_Fontname);
this.groupBox1.Controls.Add(this.label_Forecolor);
this.groupBox1.Controls.Add(this.label_Narrowbarwidth);
this.groupBox1.Controls.Add(this.label_Barheight);
this.groupBox1.Controls.Add(this.label_Imagewidth);
this.groupBox1.Controls.Add(this.label_Imageheight);
this.groupBox1.Controls.Add(this.label_Text);
this.groupBox1.Controls.Add(this.label_Symbology);
this.groupBox1.Controls.Add(this.button_Createbarcode);
this.groupBox1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.groupBox1.Location = new System.Drawing.Point(40, 200);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(680, 384);
this.groupBox1.TabIndex = 7;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Barcode Property ";
//
// textBox_Resolution
//
this.textBox_Resolution.Location = new System.Drawing.Point(520, 320);
this.textBox_Resolution.Name = "textBox_Resolution";
this.textBox_Resolution.Size = new System.Drawing.Size(120, 20);
this.textBox_Resolution.TabIndex = 45;
this.textBox_Resolution.Text = "300";
//
// label_Resolution
//
this.label_Resolution.Location = new System.Drawing.Point(352, 320);
this.label_Resolution.Name = "label_Resolution";
this.label_Resolution.Size = new System.Drawing.Size(112, 16);
this.label_Resolution.TabIndex = 44;
this.label_Resolution.Text = "ResolutionDPI";
//
// comboBox_Backcolor
//
this.comboBox_Backcolor.Items.AddRange(new object[] {
"White",
"Blue",
"Yellow",
"Red",
"Gray",
"Green"});
this.comboBox_Backcolor.Location = new System.Drawing.Point(136, 232);
this.comboBox_Backcolor.Name = "comboBox_Backcolor";
this.comboBox_Backcolor.Size = new System.Drawing.Size(120, 21);
this.comboBox_Backcolor.TabIndex = 43;
this.comboBox_Backcolor.Text = "White";
//
// label_Backcolor
//
this.label_Backcolor.Location = new System.Drawing.Point(7, 239);
this.label_Backcolor.Name = "label_Backcolor";
this.label_Backcolor.Size = new System.Drawing.Size(72, 16);
this.label_Backcolor.TabIndex = 42;
this.label_Backcolor.Text = "Back Color";
//
// textBox_Fontsize
//
this.textBox_Fontsize.Location = new System.Drawing.Point(136, 292);
this.textBox_Fontsize.Name = "textBox_Fontsize";
this.textBox_Fontsize.Size = new System.Drawing.Size(120, 20);
this.textBox_Fontsize.TabIndex = 41;
this.textBox_Fontsize.Text = "10";
//
// textBox_Width
//
this.textBox_Width.Location = new System.Drawing.Point(136, 112);
this.textBox_Width.Name = "textBox_Width";
this.textBox_Width.Size = new System.Drawing.Size(120, 20);
this.textBox_Width.TabIndex = 40;
this.textBox_Width.Text = "240";
//
// textBox_Textmargin
//
this.textBox_Textmargin.Location = new System.Drawing.Point(520, 160);
this.textBox_Textmargin.Name = "textBox_Textmargin";
this.textBox_Textmargin.Size = new System.Drawing.Size(120, 20);
this.textBox_Textmargin.TabIndex = 39;
this.textBox_Textmargin.Text = "0";
//
// textBox_Leftmargin
//
this.textBox_Leftmargin.Location = new System.Drawing.Point(520, 134);
this.textBox_Leftmargin.Name = "textBox_Leftmargin";
this.textBox_Leftmargin.Size = new System.Drawing.Size(120, 20);
this.textBox_Leftmargin.TabIndex = 38;
this.textBox_Leftmargin.Text = "200";
//
// textBox_Topmargin
//
this.textBox_Topmargin.Location = new System.Drawing.Point(520, 109);
this.textBox_Topmargin.Name = "textBox_Topmargin";
this.textBox_Topmargin.Size = new System.Drawing.Size(120, 20);
this.textBox_Topmargin.TabIndex = 37;
this.textBox_Topmargin.Text = "200";
//
// textBox_Topcommenttopmargin
//
this.textBox_Topcommenttopmargin.Location = new System.Drawing.Point(520, 80);
this.textBox_Topcommenttopmargin.Name = "textBox_Topcommenttopmargin";
this.textBox_Topcommenttopmargin.Size = new System.Drawing.Size(120, 20);
this.textBox_Topcommenttopmargin.TabIndex = 36;
this.textBox_Topcommenttopmargin.Text = "0";
//
// textBox_Topcommentleftmargin
//
this.textBox_Topcommentleftmargin.Location = new System.Drawing.Point(520, 54);
this.textBox_Topcommentleftmargin.Name = "textBox_Topcommentleftmargin";
this.textBox_Topcommentleftmargin.Size = new System.Drawing.Size(120, 20);
this.textBox_Topcommentleftmargin.TabIndex = 35;
this.textBox_Topcommentleftmargin.Text = "0";
//
// comboBox_Fontname
//
this.comboBox_Fontname.Items.AddRange(new object[] {
"Times New Roman",
"Arial, Helvetica, sans-serif",
"Arial",
"Verdana"});
this.comboBox_Fontname.Location = new System.Drawing.Point(136, 264);
this.comboBox_Fontname.Name = "comboBox_Fontname";
this.comboBox_Fontname.Size = new System.Drawing.Size(120, 21);
this.comboBox_Fontname.TabIndex = 33;
this.comboBox_Fontname.Text = "Times New Roman";
//
// comboBox_Forecolor
//
this.comboBox_Forecolor.Items.AddRange(new object[] {
"White",
"Blue",
"Yellow",
"Red",
"Gray",
"Green"});
this.comboBox_Forecolor.Location = new System.Drawing.Point(136, 205);
this.comboBox_Forecolor.Name = "comboBox_Forecolor";
this.comboBox_Forecolor.Size = new System.Drawing.Size(120, 21);
this.comboBox_Forecolor.TabIndex = 32;
this.comboBox_Forecolor.Text = "Black";
//
// textBox_Topcomment
//
this.textBox_Topcomment.Location = new System.Drawing.Point(520, 24);
this.textBox_Topcomment.Name = "textBox_Topcomment";
this.textBox_Topcomment.Size = new System.Drawing.Size(120, 20);
this.textBox_Topcomment.TabIndex = 31;
this.textBox_Topcomment.Text = "ASP.NET Control Demo";
//
// textBox_Ratio
//
this.textBox_Ratio.Location = new System.Drawing.Point(136, 318);
this.textBox_Ratio.Name = "textBox_Ratio";
this.textBox_Ratio.Size = new System.Drawing.Size(120, 20);
this.textBox_Ratio.TabIndex = 30;
this.textBox_Ratio.Text = "3";
//
// textBox_Narrowbarwidth
//
this.textBox_Narrowbarwidth.Location = new System.Drawing.Point(136, 176);
this.textBox_Narrowbarwidth.Name = "textBox_Narrowbarwidth";
this.textBox_Narrowbarwidth.Size = new System.Drawing.Size(120, 20);
this.textBox_Narrowbarwidth.TabIndex = 29;
this.textBox_Narrowbarwidth.Text = "13";
//
// textBox_Barheight
//
this.textBox_Barheight.Location = new System.Drawing.Point(136, 144);
this.textBox_Barheight.Name = "textBox_Barheight";
this.textBox_Barheight.Size = new System.Drawing.Size(120, 20);
this.textBox_Barheight.TabIndex = 28;
this.textBox_Barheight.Text = "1000";
//
// textBox_Height
//
this.textBox_Height.Location = new System.Drawing.Point(136, 80);
this.textBox_Height.Name = "textBox_Height";
this.textBox_Height.Size = new System.Drawing.Size(120, 20);
this.textBox_Height.TabIndex = 27;
this.textBox_Height.Text = "100";
//
// textBox_Text
//
this.textBox_Text.Location = new System.Drawing.Point(136, 43);
this.textBox_Text.Name = "textBox_Text";
this.textBox_Text.Size = new System.Drawing.Size(120, 20);
this.textBox_Text.TabIndex = 26;
this.textBox_Text.Text = "123456789";
//
// comboBox_Rotation
//
this.comboBox_Rotation.Items.AddRange(new object[] {
"Zero_Degree",
"90_Degree",
"180_Degree",
"270_Degree"});
this.comboBox_Rotation.Location = new System.Drawing.Point(520, 288);
this.comboBox_Rotation.Name = "comboBox_Rotation";
this.comboBox_Rotation.Size = new System.Drawing.Size(121, 21);
this.comboBox_Rotation.TabIndex = 25;
this.comboBox_Rotation.Text = "Zero_Degree";
//
// comboBox_Addcheckdigittotext
//
this.comboBox_Addcheckdigittotext.Items.AddRange(new object[] {
"True",
"False"});
this.comboBox_Addcheckdigittotext.Location = new System.Drawing.Point(520, 256);
this.comboBox_Addcheckdigittotext.Name = "comboBox_Addcheckdigittotext";
this.comboBox_Addcheckdigittotext.Size = new System.Drawing.Size(121, 21);
this.comboBox_Addcheckdigittotext.TabIndex = 24;
this.comboBox_Addcheckdigittotext.Text = "True";
//
// comboBox_Addcheckdigit
//
this.comboBox_Addcheckdigit.Items.AddRange(new object[] {
"True",
"False"});
this.comboBox_Addcheckdigit.Location = new System.Drawing.Point(520, 224);
this.comboBox_Addcheckdigit.Name = "comboBox_Addcheckdigit";
this.comboBox_Addcheckdigit.Size = new System.Drawing.Size(121, 21);
this.comboBox_Addcheckdigit.TabIndex = 23;
this.comboBox_Addcheckdigit.Text = "True";
//
// comboBox_Showtext
//
this.comboBox_Showtext.Items.AddRange(new object[] {
"True",
"False"});
this.comboBox_Showtext.Location = new System.Drawing.Point(520, 192);
this.comboBox_Showtext.Name = "comboBox_Showtext";
this.comboBox_Showtext.Size = new System.Drawing.Size(121, 21);
this.comboBox_Showtext.TabIndex = 22;
this.comboBox_Showtext.Text = "True";
//
// comboBox_Symbology
//
this.comboBox_Symbology.Items.AddRange(new object[] {
"Code 39",
"Code 39 FULL ASCII",
"Code 93",
"UPC-A",
"EAN 13",
"EAN 8",
"UPC-E",
"BOOKLAND",
"CODE 128",
"UCC/EAN 128",
"INDUSTRIAL 2 OF 5",
"INTERLEAVED 2 OF 5",
"CODE 11\t\t",
"CODABAR",
"MSI-PLESSEY",
"PDF417"});
this.comboBox_Symbology.Location = new System.Drawing.Point(136, 16);
this.comboBox_Symbology.Name = "comboBox_Symbology";
this.comboBox_Symbology.Size = new System.Drawing.Size(121, 21);
this.comboBox_Symbology.TabIndex = 21;
this.comboBox_Symbology.Text = "Code 39";
//
// label_Rotation
//
this.label_Rotation.Location = new System.Drawing.Point(352, 296);
this.label_Rotation.Name = "label_Rotation";
this.label_Rotation.Size = new System.Drawing.Size(100, 16);
this.label_Rotation.TabIndex = 20;
this.label_Rotation.Text = "Rotation";
//
// label_Addcheckditittotext
//
this.label_Addcheckditittotext.Location = new System.Drawing.Point(352, 264);
this.label_Addcheckditittotext.Name = "label_Addcheckditittotext";
this.label_Addcheckditittotext.Size = new System.Drawing.Size(160, 16);
this.label_Addcheckditittotext.TabIndex = 19;
this.label_Addcheckditittotext.Text = "Add Check Digit To HR Text";
//
// label1
//
this.label1.Location = new System.Drawing.Point(352, 232);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(100, 16);
this.label1.TabIndex = 18;
this.label1.Text = "Add Check Digit";
//
// Label_Showhrtext
//
this.Label_Showhrtext.Location = new System.Drawing.Point(352, 200);
this.Label_Showhrtext.Name = "Label_Showhrtext";
this.Label_Showhrtext.Size = new System.Drawing.Size(100, 16);
this.Label_Showhrtext.TabIndex = 17;
this.Label_Showhrtext.Text = "Show HR Text";
//
// label5
//
this.label5.Location = new System.Drawing.Point(352, 168);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(128, 16);
this.label5.TabIndex = 16;
this.label5.Text = "HR Text Margin";
//
// label_Barleftmargin
//
this.label_Barleftmargin.Location = new System.Drawing.Point(352, 139);
this.label_Barleftmargin.Name = "label_Barleftmargin";
this.label_Barleftmargin.Size = new System.Drawing.Size(136, 13);
this.label_Barleftmargin.TabIndex = 15;
this.label_Barleftmargin.Text = "Barcode Left Margin";
//
// label_Bartopmargin
//
this.label_Bartopmargin.Location = new System.Drawing.Point(352, 112);
this.label_Bartopmargin.Name = "label_Bartopmargin";
this.label_Bartopmargin.Size = new System.Drawing.Size(136, 16);
this.label_Bartopmargin.TabIndex = 14;
this.label_Bartopmargin.Text = "Barcode Top Margin";
//
// label_Barratio
//
this.label_Barratio.Location = new System.Drawing.Point(11, 320);
this.label_Barratio.Name = "label_Barratio";
this.label_Barratio.Size = new System.Drawing.Size(100, 14);
this.label_Barratio.TabIndex = 13;
this.label_Barratio.Text = "Bar Ratio";
//
// label_Topcommenttopmargin
//
this.label_Topcommenttopmargin.Location = new System.Drawing.Point(352, 83);
this.label_Topcommenttopmargin.Name = "label_Topcommenttopmargin";
this.label_Topcommenttopmargin.Size = new System.Drawing.Size(168, 16);
this.label_Topcommenttopmargin.TabIndex = 12;
this.label_Topcommenttopmargin.Text = "Topcomment Top Margin";
//
// label_Topcommentleftmargin
//
this.label_Topcommentleftmargin.Location = new System.Drawing.Point(352, 55);
this.label_Topcommentleftmargin.Name = "label_Topcommentleftmargin";
this.label_Topcommentleftmargin.Size = new System.Drawing.Size(160, 16);
this.label_Topcommentleftmargin.TabIndex = 11;
this.label_Topcommentleftmargin.Text = "Topcomment Left Margin";
//
// label10
//
this.label10.Location = new System.Drawing.Point(353, 24);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(100, 16);
this.label10.TabIndex = 10;
this.label10.Text = "Top Comment";
//
// label9
//
this.label9.Location = new System.Drawing.Point(8, 291);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(100, 16);
this.label9.TabIndex = 9;
this.label9.Text = "Font Size";
//
// label_Fontname
//
this.label_Fontname.Location = new System.Drawing.Point(8, 267);
this.label_Fontname.Name = "label_Fontname";
this.label_Fontname.Size = new System.Drawing.Size(100, 15);
this.label_Fontname.TabIndex = 8;
this.label_Fontname.Text = "Font Name";
//
// label_Forecolor
//
this.label_Forecolor.Location = new System.Drawing.Point(8, 207);
this.label_Forecolor.Name = "label_Forecolor";
this.label_Forecolor.Size = new System.Drawing.Size(100, 16);
this.label_Forecolor.TabIndex = 7;
this.label_Forecolor.Text = "Fore Color";
//
// label_Narrowbarwidth
//
this.label_Narrowbarwidth.Location = new System.Drawing.Point(8, 176);
this.label_Narrowbarwidth.Name = "label_Narrowbarwidth";
this.label_Narrowbarwidth.Size = new System.Drawing.Size(120, 16);
this.label_Narrowbarwidth.TabIndex = 6;
this.label_Narrowbarwidth.Text = "Narrow Bar Width";
//
// label_Barheight
//
this.label_Barheight.Location = new System.Drawing.Point(8, 145);
this.label_Barheight.Name = "label_Barheight";
this.label_Barheight.Size = new System.Drawing.Size(112, 16);
this.label_Barheight.TabIndex = 5;
this.label_Barheight.Text = "Barcode Height";
//
// label_Imagewidth
//
this.label_Imagewidth.Location = new System.Drawing.Point(8, 112);
this.label_Imagewidth.Name = "label_Imagewidth";
this.label_Imagewidth.Size = new System.Drawing.Size(100, 16);
this.label_Imagewidth.TabIndex = 4;
this.label_Imagewidth.Text = "Image Width(Pixel)";
//
// label_Imageheight
//
this.label_Imageheight.Location = new System.Drawing.Point(8, 80);
this.label_Imageheight.Name = "label_Imageheight";
this.label_Imageheight.Size = new System.Drawing.Size(104, 16);
this.label_Imageheight.TabIndex = 3;
this.label_Imageheight.Text = "Image Height(Pixel)";
//
// label_Text
//
this.label_Text.Location = new System.Drawing.Point(8, 46);
this.label_Text.Name = "label_Text";
this.label_Text.Size = new System.Drawing.Size(100, 16);
this.label_Text.TabIndex = 2;
this.label_Text.Text = "Text";
//
// label_Symbology
//
this.label_Symbology.Location = new System.Drawing.Point(8, 18);
this.label_Symbology.Name = "label_Symbology";
this.label_Symbology.Size = new System.Drawing.Size(100, 14);
this.label_Symbology.TabIndex = 1;
this.label_Symbology.Text = "Symbology";
//
// button_Createbarcode
//
this.button_Createbarcode.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.button_Createbarcode.Location = new System.Drawing.Point(0, 352);
this.button_Createbarcode.Name = "button_Createbarcode";
this.button_Createbarcode.Size = new System.Drawing.Size(680, 23);
this.button_Createbarcode.TabIndex = 0;
this.button_Createbarcode.Text = "Click Here To Create New Barcode";
this.button_Createbarcode.Click += new System.EventHandler(this.button_Createbarcode_Click);
//
// textBox_Path
//
this.textBox_Path.Location = new System.Drawing.Point(40, 176);
this.textBox_Path.Name = "textBox_Path";
this.textBox_Path.TabIndex = 8;
this.textBox_Path.Text = "c:\\test.jpg";
//
// comboBox_Format
//
this.comboBox_Format.Items.AddRange(new object[] {
"Bmp ",
"Emf ",
"Gif ",
"Jpeg ",
"Png ",
"Tiff",
"Wmf ",
""});
this.comboBox_Format.Location = new System.Drawing.Point(144, 176);
this.comboBox_Format.Name = "comboBox_Format";
this.comboBox_Format.Size = new System.Drawing.Size(80, 21);
this.comboBox_Format.TabIndex = 9;
this.comboBox_Format.Text = "Jpeg ";
//
// groupBox2
//
this.groupBox2.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.groupBox2.Controls.Add(this.easeWinControl1);
this.groupBox2.Location = new System.Drawing.Point(40, 8);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(680, 160);
this.groupBox2.TabIndex = 10;
this.groupBox2.TabStop = false;
//
// easeWinControl1
//
this.easeWinControl1.AddCheckDigit = true;
this.easeWinControl1.AddCheckDigitToText = true;
this.easeWinControl1.BarHeight = 1000;
this.easeWinControl1.LeftMargin = 200;
this.easeWinControl1.Location = new System.Drawing.Point(224, 8);
this.easeWinControl1.Name = "easeWinControl1";
this.easeWinControl1.NarrowBarWidth = 10;
this.easeWinControl1.PDFAspectRatio = 1;
this.easeWinControl1.PDFMaxCols = 0;
this.easeWinControl1.PDFMaxRows = 0;
this.easeWinControl1.PDFModuleHeight = 30;
this.easeWinControl1.PDFModuleWidth = 10;
this.easeWinControl1.PDFSecurityLevel = 9;
this.easeWinControl1.PDFTruncatedSymbol = false;
this.easeWinControl1.Ratio = 3;
this.easeWinControl1.ResolutionDPI = 300;
this.easeWinControl1.Rotation = EaseSoftBarcode.Rotation.Clockwise_Zero_Degree;
this.easeWinControl1.ShowText = true;
this.easeWinControl1.Size = new System.Drawing.Size(240, 150);
this.easeWinControl1.SymbologyID = EaseSoftBarcode.Symbology.Code39;
this.easeWinControl1.TabIndex = 0;
this.easeWinControl1.TextMargin = 0;
this.easeWinControl1.TopComment = "ASP.NET BARCODE CONTROL";
this.easeWinControl1.TopCommentLeftMargin = 0;
this.easeWinControl1.TopCommentTopMargin = 0;
this.easeWinControl1.TopMargin = 200;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.SystemColors.ScrollBar;
this.ClientSize = new System.Drawing.Size(752, 598);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.comboBox_Format);
this.Controls.Add(this.textBox_Path);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.button_print);
this.Controls.Add(this.button_printpreview);
this.Controls.Add(this.button_save);
this.Name = "Form1";
this.Text = "EaseSoft Barcode Control Demo";
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void button_save_Click(object sender, System.EventArgs e)
{
ImageFormat format;
switch( comboBox_Format.SelectedIndex)
{
case 0: format = ImageFormat.Bmp;break;
case 1: format = ImageFormat.Emf;break;
case 2: format = ImageFormat.Gif;break;
case 3: format = ImageFormat.Jpeg;break;
case 4: format = ImageFormat.Png;break;
case 5: format = ImageFormat.Tiff;break;
case 6: format = ImageFormat.Wmf;break;
default:format = ImageFormat.Bmp;break;
}
easeWinControl1.Picture.Save(@textBox_Path.Text,format);

}


private void PrintPageEventHandler(Object obj,PrintPageEventArgs ev)
{
Graphics g = ev.Graphics;
g.DrawImage(easeWinControl1.Picture,40,100);
}

private void button_printpreview_Click(object sender, System.EventArgs e)
{
try
{
printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.PrintPageEventHandler);
printPreviewDialog1.Document = printDocument1;
printDocument1.DocumentName = " EaseSoft Barcode Print Test";
printPreviewDialog1.ShowDialog();
}
catch( Exception ex)
{
MessageBox.Show( ex.Message);
}
}

private void button_print_Click(object sender, System.EventArgs e)
{
try
{
printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.PrintPageEventHandler);
printDocument1.DocumentName = " EaseSoft Barcode Print Test";
printDocument1.Print();

}
catch( Exception ex)
{
MessageBox.Show( ex.Message);
}
}

private void button1_Click(object sender, System.EventArgs e)
{
System.Windows.Forms.DataObject dataobj = new DataObject();
Bitmap bitmap1= easeWinControl1.Picture;
dataobj.SetData(System.Windows.Forms.DataFormats.Bitmap,true,bitmap1);
Clipboard.SetDataObject(dataobj,true);
bitmap1.Dispose();
}

private void button_Createbarcode_Click(object sender, System.EventArgs e)
{
int fontsize=10;
EaseSoftBarcode.Symbology symbology ;
EaseSoftBarcode.Rotation rotation;

switch( comboBox_Rotation.SelectedIndex)
{
case 0: rotation = Rotation.Clockwise_Zero_Degree;break;
case 1: rotation = Rotation.Clockwise_90_Degree;break;
case 2: rotation = Rotation.Clockwise_180_Degree;break;
case 3: rotation = Rotation.Clockwise_270_Degree;break;
default:rotation = Rotation.Clockwise_Zero_Degree;break;
}
switch( comboBox_Symbology.SelectedIndex)
{
case 0: symbology= Symbology.Code39;break;
case 1: symbology= Symbology.Code39ASCII;break;
case 2: symbology= Symbology.Code93;break;
case 3: symbology= Symbology.UPCA;break;
case 4: symbology= Symbology.EAN13;break;
case 5: symbology= Symbology.EAN8;break;
case 6: symbology= Symbology.UPCE;break;
case 7: symbology= Symbology.BookLand;break;
case 8: symbology= Symbology.Code128;break;
case 9: symbology= Symbology.UCC128;break;
case 10: symbology=Symbology.Code25;break;
case 11: symbology=Symbology.I25;break;
case 12: symbology=Symbology.Code11;break;
case 13: symbology=Symbology.Codabar;break;
case 14: symbology=Symbology.MSI;break;
case 15: symbology=Symbology.PDF417;break;
default: symbology=Symbology.Code39;break;
}
easeWinControl1.SymbologyID= symbology;
easeWinControl1.TextToEncode = textBox_Text.Text;

try
{
fontsize= Convert.ToInt32(textBox_Fontsize.Text);
easeWinControl1.Font=new Font(comboBox_Fontname.Text,fontsize);
easeWinControl1.Ratio=Convert.ToInt32(textBox_Ratio.Text);
easeWinControl1.ResolutionDPI =Convert.ToInt32(textBox_Resolution.Text);
easeWinControl1.Height=Convert.ToInt32(textBox_Height.Text);
easeWinControl1.Width=Convert.ToInt32(textBox_Width.Text);
easeWinControl1.BarHeight=Convert.ToDouble(textBox_Barheight.Text);
easeWinControl1.NarrowBarWidth=Convert.ToDouble(textBox_Narrowbarwidth.Text);
easeWinControl1.TopMargin=Convert.ToDouble(textBox_Topmargin.Text);
easeWinControl1.LeftMargin=Convert.ToDouble(textBox_Leftmargin.Text);
easeWinControl1.TextMargin=Convert.ToDouble(textBox_Textmargin.Text);
easeWinControl1.TopCommentTopMargin =Convert.ToDouble(textBox_Topcommenttopmargin.Text);
easeWinControl1.TopCommentLeftMargin =Convert.ToDouble(textBox_Topcommentleftmargin.Text);
}
catch{};

easeWinControl1.ForeColor= Color.FromName(comboBox_Forecolor.Text);
easeWinControl1.BackColor= Color.FromName(comboBox_Backcolor.Text);
easeWinControl1.ShowText= (comboBox_Showtext.SelectedIndex==0);
easeWinControl1.AddCheckDigit=(comboBox_Addcheckdigit.SelectedIndex==0);
easeWinControl1.AddCheckDigitToText=(comboBox_Addcheckdigittotext.SelectedIndex==0);
easeWinControl1.Rotation = rotation;
easeWinControl1.TopComment = textBox_Topcomment.Text;

}

}
}

 
© 2000-2006 EaseSoft Inc. All Rights Reserved.Terms of Use | Privacy Statement