diff --git a/Barcode.sln b/Barcode.sln index d6cb3c7..93c83d5 100644 --- a/Barcode.sln +++ b/Barcode.sln @@ -37,6 +37,7 @@ Global EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {8DB57BA1-E88C-43D9-AD0E-04BFA6B11C61}.Debug|.NET.ActiveCfg = Debug|Any CPU + {8DB57BA1-E88C-43D9-AD0E-04BFA6B11C61}.Debug|.NET.Build.0 = Debug|Any CPU {8DB57BA1-E88C-43D9-AD0E-04BFA6B11C61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8DB57BA1-E88C-43D9-AD0E-04BFA6B11C61}.Debug|Any CPU.Build.0 = Debug|Any CPU {8DB57BA1-E88C-43D9-AD0E-04BFA6B11C61}.Debug|x86.ActiveCfg = Debug|Any CPU @@ -45,6 +46,7 @@ Global {8DB57BA1-E88C-43D9-AD0E-04BFA6B11C61}.Release|Any CPU.Build.0 = Release|Any CPU {8DB57BA1-E88C-43D9-AD0E-04BFA6B11C61}.Release|x86.ActiveCfg = Release|Any CPU {F8646414-0C9C-49BB-9DA3-3923BF78A398}.Debug|.NET.ActiveCfg = Debug|Any CPU + {F8646414-0C9C-49BB-9DA3-3923BF78A398}.Debug|.NET.Build.0 = Debug|Any CPU {F8646414-0C9C-49BB-9DA3-3923BF78A398}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F8646414-0C9C-49BB-9DA3-3923BF78A398}.Debug|Any CPU.Build.0 = Debug|Any CPU {F8646414-0C9C-49BB-9DA3-3923BF78A398}.Debug|x86.ActiveCfg = Debug|x86 diff --git a/BarcodeLib/BarcodeLib.cs b/BarcodeLib/BarcodeLib.cs index 6395e7d..c233c8c 100644 --- a/BarcodeLib/BarcodeLib.cs +++ b/BarcodeLib/BarcodeLib.cs @@ -183,6 +183,16 @@ public bool IncludeLabel get; set; } + + /// + /// Alternate label to be displayed. (IncludeLabel must be set to true as well) + /// + public String AlternateLabel + { + get; + set; + } + /// /// Gets or sets the amount of time in milliseconds that it took to encode and draw the barcode. /// @@ -739,7 +749,7 @@ private Image Label_ITF14(Image img) //draw datastring under the barcode image StringFormat f = new StringFormat(); f.Alignment = StringAlignment.Center; - g.DrawString(this.RawData, font, new SolidBrush(this.ForeColor), (float)(img.Width / 2), img.Height - font.Height + 1, f); + g.DrawString(AlternateLabel == null ? RawData : AlternateLabel, font, new SolidBrush(ForeColor), (float)(img.Width / 2), img.Height - font.Height + 1, f); Pen pen = new Pen(ForeColor, (float)img.Height / 16); pen.Alignment = PenAlignment.Inset; @@ -810,10 +820,10 @@ private Image Label_Generic(Image img) }//switch //color a background color box at the bottom of the barcode to hold the string of data - g.FillRectangle(new SolidBrush(this.BackColor), new RectangleF((float)0, (float)LabelY, (float)img.Width, (float)font.Height)); + g.FillRectangle(new SolidBrush(BackColor), new RectangleF((float)0, (float)LabelY, (float)img.Width, (float)font.Height)); //draw datastring under the barcode image - g.DrawString(this.RawData, font, new SolidBrush(this.ForeColor), new RectangleF((float)0, (float)LabelY, (float)img.Width, (float)font.Height), f); + g.DrawString(AlternateLabel == null ? RawData : AlternateLabel, font, new SolidBrush(ForeColor), new RectangleF((float)0, (float)LabelY, (float)img.Width, (float)font.Height), f); g.Save(); }//using diff --git a/BarcodeLib/Release Notes.txt b/BarcodeLib/Release Notes.txt index e4d5a44..b9c6cb2 100644 --- a/BarcodeLib/Release Notes.txt +++ b/BarcodeLib/Release Notes.txt @@ -1,7 +1,8 @@ Release Notes for BarcodeLib.dll ================================ 1.0.0.18 -- +- cleaned up layout of test application +- added alternate label text property 1.0.0.17 - Fixed a bug in Code 11 where K checksums were being calculated for messages shorter than 10 characters in length. - Fixed a bug in PostNet that drew incorrectly for all PostNet barcodes (thanks jonney3099) diff --git a/BarcodeLibTest/BarcodeLibTest.csproj b/BarcodeLibTest/BarcodeLibTest.csproj index b76d851..2d0af0e 100644 --- a/BarcodeLibTest/BarcodeLibTest.csproj +++ b/BarcodeLibTest/BarcodeLibTest.csproj @@ -13,7 +13,7 @@ 1465CABE4A879E249A14FA206FD2C53D4E943647 BarcodeLibTest_TemporaryKey.pfx true - true + false true @@ -86,7 +86,6 @@ Resources.resx True - SettingsSingleFileGenerator Settings.Designer.cs diff --git a/BarcodeLibTest/TestApp.Designer.cs b/BarcodeLibTest/TestApp.Designer.cs index 5727630..de8762b 100644 --- a/BarcodeLibTest/TestApp.Designer.cs +++ b/BarcodeLibTest/TestApp.Designer.cs @@ -30,89 +30,53 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestApp)); - this.barcode = new System.Windows.Forms.PictureBox(); - this.txtEncoded = new System.Windows.Forms.TextBox(); - this.txtData = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.tsslEncodedType = new System.Windows.Forms.ToolStripStatusLabel(); this.tslblLibraryVersion = new System.Windows.Forms.ToolStripStatusLabel(); this.tslblCredits = new System.Windows.Forms.ToolStripStatusLabel(); - this.label2 = new System.Windows.Forms.Label(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.barcode = new System.Windows.Forms.GroupBox(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.txtWidth = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.txtHeight = new System.Windows.Forms.TextBox(); + this.label9 = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.chkGenerateLabel = new System.Windows.Forms.CheckBox(); + this.label11 = new System.Windows.Forms.Label(); + this.cbLabelLocation = new System.Windows.Forms.ComboBox(); + this.lblLabelLocation = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.cbRotateFlip = new System.Windows.Forms.ComboBox(); this.btnSave = new System.Windows.Forms.Button(); this.btnSaveXML = new System.Windows.Forms.Button(); - this.lblLabelLocation = new System.Windows.Forms.Label(); this.btnLoadXML = new System.Windows.Forms.Button(); this.label8 = new System.Windows.Forms.Label(); this.btnEncode = new System.Windows.Forms.Button(); - this.txtHeight = new System.Windows.Forms.TextBox(); - this.cbLabelLocation = new System.Windows.Forms.ComboBox(); this.label4 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.txtWidth = new System.Windows.Forms.TextBox(); - this.label7 = new System.Windows.Forms.Label(); + this.txtEncoded = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.btnBackColor = new System.Windows.Forms.Button(); this.cbBarcodeAlign = new System.Windows.Forms.ComboBox(); this.btnForeColor = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); this.lblEncodingTime = new System.Windows.Forms.Label(); - this.chkGenerateLabel = new System.Windows.Forms.CheckBox(); this.label3 = new System.Windows.Forms.Label(); this.cbEncodeType = new System.Windows.Forms.ComboBox(); - this.label9 = new System.Windows.Forms.Label(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.txtData = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components); - ((System.ComponentModel.ISupportInitialize)(this.barcode)).BeginInit(); this.statusStrip1.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.groupBox2.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit(); this.SuspendLayout(); // - // barcode - // - this.barcode.BackColor = System.Drawing.Color.Transparent; - this.barcode.Dock = System.Windows.Forms.DockStyle.Fill; - this.barcode.Location = new System.Drawing.Point(3, 16); - this.barcode.Name = "barcode"; - this.barcode.Size = new System.Drawing.Size(395, 317); - this.barcode.TabIndex = 13; - this.barcode.TabStop = false; - // - // txtEncoded - // - this.txtEncoded.Location = new System.Drawing.Point(4, 162); - this.txtEncoded.Multiline = true; - this.txtEncoded.Name = "txtEncoded"; - this.txtEncoded.ReadOnly = true; - this.txtEncoded.Size = new System.Drawing.Size(108, 114); - this.txtEncoded.TabIndex = 14; - this.txtEncoded.TabStop = false; - // - // txtData - // - this.txtData.Location = new System.Drawing.Point(4, 36); - this.txtData.Name = "txtData"; - this.txtData.Size = new System.Drawing.Size(194, 20); - this.txtData.TabIndex = 1; - this.txtData.Text = "038000356216"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(1, 20); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(86, 13); - this.label1.TabIndex = 29; - this.label1.Text = "Value to Encode"; - // // statusStrip1 // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -147,59 +111,185 @@ private void InitializeComponent() this.tslblCredits.Text = "Written by: Brad Barnhill"; this.tslblCredits.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label2 + // barcode // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(1, 146); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(80, 13); - this.label2.TabIndex = 33; - this.label2.Text = "Encoded Value"; + this.barcode.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.barcode.Dock = System.Windows.Forms.DockStyle.Fill; + this.barcode.Location = new System.Drawing.Point(0, 0); + this.barcode.Name = "barcode"; + this.barcode.Size = new System.Drawing.Size(369, 336); + this.barcode.TabIndex = 36; + this.barcode.TabStop = false; + this.barcode.Text = "Barcode Image"; + // + // splitContainer1 // - // groupBox1 - // - this.groupBox1.Controls.Add(this.label10); - this.groupBox1.Controls.Add(this.cbRotateFlip); - this.groupBox1.Controls.Add(this.btnSave); - this.groupBox1.Controls.Add(this.btnSaveXML); - this.groupBox1.Controls.Add(this.lblLabelLocation); - this.groupBox1.Controls.Add(this.btnLoadXML); - this.groupBox1.Controls.Add(this.label8); - this.groupBox1.Controls.Add(this.btnEncode); - this.groupBox1.Controls.Add(this.txtHeight); - this.groupBox1.Controls.Add(this.cbLabelLocation); - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.label6); - this.groupBox1.Controls.Add(this.txtEncoded); - this.groupBox1.Controls.Add(this.txtWidth); - this.groupBox1.Controls.Add(this.label7); - this.groupBox1.Controls.Add(this.label5); - this.groupBox1.Controls.Add(this.btnBackColor); - this.groupBox1.Controls.Add(this.cbBarcodeAlign); - this.groupBox1.Controls.Add(this.btnForeColor); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.lblEncodingTime); - this.groupBox1.Controls.Add(this.chkGenerateLabel); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.cbEncodeType); - this.groupBox1.Controls.Add(this.txtData); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.label9); - this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; - this.groupBox1.Location = new System.Drawing.Point(0, 0); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(218, 336); - this.groupBox1.TabIndex = 35; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "User Information"; + this.splitContainer1.BackColor = System.Drawing.SystemColors.Control; + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.groupBox4); + this.splitContainer1.Panel1.Controls.Add(this.groupBox3); + this.splitContainer1.Panel1.Controls.Add(this.label10); + this.splitContainer1.Panel1.Controls.Add(this.cbRotateFlip); + this.splitContainer1.Panel1.Controls.Add(this.btnSave); + this.splitContainer1.Panel1.Controls.Add(this.btnSaveXML); + this.splitContainer1.Panel1.Controls.Add(this.btnLoadXML); + this.splitContainer1.Panel1.Controls.Add(this.label8); + this.splitContainer1.Panel1.Controls.Add(this.btnEncode); + this.splitContainer1.Panel1.Controls.Add(this.label4); + this.splitContainer1.Panel1.Controls.Add(this.txtEncoded); + this.splitContainer1.Panel1.Controls.Add(this.label5); + this.splitContainer1.Panel1.Controls.Add(this.btnBackColor); + this.splitContainer1.Panel1.Controls.Add(this.cbBarcodeAlign); + this.splitContainer1.Panel1.Controls.Add(this.btnForeColor); + this.splitContainer1.Panel1.Controls.Add(this.label2); + this.splitContainer1.Panel1.Controls.Add(this.lblEncodingTime); + this.splitContainer1.Panel1.Controls.Add(this.label3); + this.splitContainer1.Panel1.Controls.Add(this.cbEncodeType); + this.splitContainer1.Panel1.Controls.Add(this.txtData); + this.splitContainer1.Panel1.Controls.Add(this.label1); + this.splitContainer1.Panel1MinSize = 250; + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.barcode); + this.splitContainer1.Size = new System.Drawing.Size(623, 336); + this.splitContainer1.SplitterDistance = 250; + this.splitContainer1.TabIndex = 37; + this.splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.splitContainer1_SplitterMoved); + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.txtWidth); + this.groupBox4.Controls.Add(this.label7); + this.groupBox4.Controls.Add(this.label6); + this.groupBox4.Controls.Add(this.txtHeight); + this.groupBox4.Controls.Add(this.label9); + this.groupBox4.Location = new System.Drawing.Point(136, 44); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(110, 49); + this.groupBox4.TabIndex = 78; + this.groupBox4.TabStop = false; + // + // txtWidth + // + this.txtWidth.Location = new System.Drawing.Point(16, 25); + this.txtWidth.Name = "txtWidth"; + this.txtWidth.Size = new System.Drawing.Size(35, 20); + this.txtWidth.TabIndex = 43; + this.txtWidth.Text = "300"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(13, 12); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(35, 13); + this.label7.TabIndex = 41; + this.label7.Text = "Width"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(57, 12); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(38, 13); + this.label6.TabIndex = 42; + this.label6.Text = "Height"; + // + // txtHeight + // + this.txtHeight.Location = new System.Drawing.Point(59, 25); + this.txtHeight.Name = "txtHeight"; + this.txtHeight.Size = new System.Drawing.Size(35, 20); + this.txtHeight.TabIndex = 44; + this.txtHeight.Text = "150"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(50, 27); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(12, 13); + this.label9.TabIndex = 51; + this.label9.Text = "x"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.textBox1); + this.groupBox3.Controls.Add(this.chkGenerateLabel); + this.groupBox3.Controls.Add(this.label11); + this.groupBox3.Controls.Add(this.cbLabelLocation); + this.groupBox3.Controls.Add(this.lblLabelLocation); + this.groupBox3.Location = new System.Drawing.Point(136, 99); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(110, 120); + this.groupBox3.TabIndex = 77; + this.groupBox3.TabStop = false; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(4, 52); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(100, 20); + this.textBox1.TabIndex = 54; + // + // chkGenerateLabel + // + this.chkGenerateLabel.AutoSize = true; + this.chkGenerateLabel.Location = new System.Drawing.Point(6, 14); + this.chkGenerateLabel.Name = "chkGenerateLabel"; + this.chkGenerateLabel.Size = new System.Drawing.Size(95, 17); + this.chkGenerateLabel.TabIndex = 40; + this.chkGenerateLabel.Text = "Generate label"; + this.chkGenerateLabel.UseVisualStyleBackColor = true; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(3, 39); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(102, 13); + this.label11.TabIndex = 55; + this.label11.Text = "Alternate Label Text"; + // + // cbLabelLocation + // + this.cbLabelLocation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbLabelLocation.FormattingEnabled = true; + this.cbLabelLocation.Items.AddRange(new object[] { + "BottomCenter", + "BottomLeft", + "BottomRight", + "TopCenter", + "TopLeft", + "TopRight"}); + this.cbLabelLocation.Location = new System.Drawing.Point(6, 94); + this.cbLabelLocation.Name = "cbLabelLocation"; + this.cbLabelLocation.Size = new System.Drawing.Size(90, 21); + this.cbLabelLocation.TabIndex = 0; + // + // lblLabelLocation + // + this.lblLabelLocation.AutoSize = true; + this.lblLabelLocation.Location = new System.Drawing.Point(3, 78); + this.lblLabelLocation.Name = "lblLabelLocation"; + this.lblLabelLocation.Size = new System.Drawing.Size(77, 13); + this.lblLabelLocation.TabIndex = 48; + this.lblLabelLocation.Text = "Label Location"; // // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(1, 102); + this.label10.Location = new System.Drawing.Point(5, 90); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(39, 13); - this.label10.TabIndex = 53; + this.label10.TabIndex = 76; this.label10.Text = "Rotate"; // // cbRotateFlip @@ -210,46 +300,37 @@ private void InitializeComponent() "Center", "Left", "Right"}); - this.cbRotateFlip.Location = new System.Drawing.Point(4, 118); + this.cbRotateFlip.Location = new System.Drawing.Point(7, 106); this.cbRotateFlip.Name = "cbRotateFlip"; this.cbRotateFlip.Size = new System.Drawing.Size(108, 21); - this.cbRotateFlip.TabIndex = 52; + this.cbRotateFlip.TabIndex = 75; // // btnSave // - this.btnSave.Location = new System.Drawing.Point(71, 285); + this.btnSave.Location = new System.Drawing.Point(81, 283); this.btnSave.Name = "btnSave"; - this.btnSave.Size = new System.Drawing.Size(61, 52); - this.btnSave.TabIndex = 4; + this.btnSave.Size = new System.Drawing.Size(69, 46); + this.btnSave.TabIndex = 61; this.btnSave.Text = "&Save As"; this.btnSave.UseVisualStyleBackColor = true; this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // btnSaveXML // - this.btnSaveXML.Location = new System.Drawing.Point(138, 285); + this.btnSaveXML.Location = new System.Drawing.Point(166, 283); this.btnSaveXML.Name = "btnSaveXML"; - this.btnSaveXML.Size = new System.Drawing.Size(76, 23); - this.btnSaveXML.TabIndex = 46; + this.btnSaveXML.Size = new System.Drawing.Size(77, 23); + this.btnSaveXML.TabIndex = 71; this.btnSaveXML.Text = "Save &XML"; this.btnSaveXML.UseVisualStyleBackColor = true; this.btnSaveXML.Click += new System.EventHandler(this.btnSaveXML_Click); // - // lblLabelLocation - // - this.lblLabelLocation.AutoSize = true; - this.lblLabelLocation.Location = new System.Drawing.Point(121, 146); - this.lblLabelLocation.Name = "lblLabelLocation"; - this.lblLabelLocation.Size = new System.Drawing.Size(77, 13); - this.lblLabelLocation.TabIndex = 48; - this.lblLabelLocation.Text = "Label Location"; - // // btnLoadXML // - this.btnLoadXML.Location = new System.Drawing.Point(138, 314); + this.btnLoadXML.Location = new System.Drawing.Point(166, 306); this.btnLoadXML.Name = "btnLoadXML"; this.btnLoadXML.Size = new System.Drawing.Size(77, 23); - this.btnLoadXML.TabIndex = 47; + this.btnLoadXML.TabIndex = 72; this.btnLoadXML.Text = "Load XML"; this.btnLoadXML.UseVisualStyleBackColor = true; this.btnLoadXML.Click += new System.EventHandler(this.btnLoadXML_Click); @@ -257,97 +338,58 @@ private void InitializeComponent() // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(121, 102); + this.label8.Location = new System.Drawing.Point(5, 132); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(53, 13); - this.label8.TabIndex = 50; + this.label8.TabIndex = 74; this.label8.Text = "Alignment"; // // btnEncode // - this.btnEncode.Location = new System.Drawing.Point(4, 285); + this.btnEncode.Location = new System.Drawing.Point(7, 283); this.btnEncode.Name = "btnEncode"; - this.btnEncode.Size = new System.Drawing.Size(61, 52); - this.btnEncode.TabIndex = 3; + this.btnEncode.Size = new System.Drawing.Size(69, 46); + this.btnEncode.TabIndex = 60; this.btnEncode.Text = "&Encode"; this.btnEncode.UseVisualStyleBackColor = true; this.btnEncode.Click += new System.EventHandler(this.btnEncode_Click); // - // txtHeight - // - this.txtHeight.Location = new System.Drawing.Point(167, 76); - this.txtHeight.Name = "txtHeight"; - this.txtHeight.Size = new System.Drawing.Size(35, 20); - this.txtHeight.TabIndex = 44; - this.txtHeight.Text = "150"; - // - // cbLabelLocation - // - this.cbLabelLocation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbLabelLocation.FormattingEnabled = true; - this.cbLabelLocation.Items.AddRange(new object[] { - "BottomCenter", - "BottomLeft", - "BottomRight", - "TopCenter", - "TopLeft", - "TopRight"}); - this.cbLabelLocation.Location = new System.Drawing.Point(124, 162); - this.cbLabelLocation.Name = "cbLabelLocation"; - this.cbLabelLocation.Size = new System.Drawing.Size(90, 21); - this.cbLabelLocation.TabIndex = 0; - // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(121, 191); + this.label4.Location = new System.Drawing.Point(5, 176); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(88, 13); - this.label4.TabIndex = 38; - this.label4.Text = "Foreground Color"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(165, 59); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(38, 13); - this.label6.TabIndex = 42; - this.label6.Text = "Height"; - // - // txtWidth - // - this.txtWidth.Location = new System.Drawing.Point(124, 76); - this.txtWidth.Name = "txtWidth"; - this.txtWidth.Size = new System.Drawing.Size(35, 20); - this.txtWidth.TabIndex = 43; - this.txtWidth.Text = "300"; + this.label4.Size = new System.Drawing.Size(61, 13); + this.label4.TabIndex = 68; + this.label4.Text = "Foreground"; // - // label7 + // txtEncoded // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(121, 59); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(35, 13); - this.label7.TabIndex = 41; - this.label7.Text = "Width"; + this.txtEncoded.Location = new System.Drawing.Point(7, 236); + this.txtEncoded.Multiline = true; + this.txtEncoded.Name = "txtEncoded"; + this.txtEncoded.ReadOnly = true; + this.txtEncoded.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtEncoded.Size = new System.Drawing.Size(238, 36); + this.txtEncoded.TabIndex = 62; + this.txtEncoded.TabStop = false; // // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(121, 237); + this.label5.Location = new System.Drawing.Point(69, 176); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(92, 13); - this.label5.TabIndex = 39; - this.label5.Text = "Background Color"; + this.label5.Size = new System.Drawing.Size(65, 13); + this.label5.TabIndex = 69; + this.label5.Text = "Background"; // // btnBackColor // this.btnBackColor.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnBackColor.Location = new System.Drawing.Point(124, 253); + this.btnBackColor.Location = new System.Drawing.Point(72, 192); this.btnBackColor.Name = "btnBackColor"; - this.btnBackColor.Size = new System.Drawing.Size(90, 23); - this.btnBackColor.TabIndex = 37; + this.btnBackColor.Size = new System.Drawing.Size(58, 23); + this.btnBackColor.TabIndex = 67; this.btnBackColor.UseVisualStyleBackColor = true; this.btnBackColor.Click += new System.EventHandler(this.btnBackColor_Click); // @@ -359,46 +401,45 @@ private void InitializeComponent() "Center", "Left", "Right"}); - this.cbBarcodeAlign.Location = new System.Drawing.Point(124, 118); + this.cbBarcodeAlign.Location = new System.Drawing.Point(7, 148); this.cbBarcodeAlign.Name = "cbBarcodeAlign"; - this.cbBarcodeAlign.Size = new System.Drawing.Size(67, 21); - this.cbBarcodeAlign.TabIndex = 49; + this.cbBarcodeAlign.Size = new System.Drawing.Size(107, 21); + this.cbBarcodeAlign.TabIndex = 73; // // btnForeColor // this.btnForeColor.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnForeColor.Location = new System.Drawing.Point(124, 207); + this.btnForeColor.Location = new System.Drawing.Point(7, 192); this.btnForeColor.Name = "btnForeColor"; - this.btnForeColor.Size = new System.Drawing.Size(90, 23); - this.btnForeColor.TabIndex = 36; + this.btnForeColor.Size = new System.Drawing.Size(58, 23); + this.btnForeColor.TabIndex = 66; this.btnForeColor.UseVisualStyleBackColor = true; this.btnForeColor.Click += new System.EventHandler(this.btnForeColor_Click); // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(5, 222); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(80, 13); + this.label2.TabIndex = 64; + this.label2.Text = "Encoded Value"; + // // lblEncodingTime // this.lblEncodingTime.AutoSize = true; - this.lblEncodingTime.Location = new System.Drawing.Point(84, 146); + this.lblEncodingTime.Location = new System.Drawing.Point(87, 134); this.lblEncodingTime.Name = "lblEncodingTime"; this.lblEncodingTime.Size = new System.Drawing.Size(0, 13); - this.lblEncodingTime.TabIndex = 45; - // - // chkGenerateLabel - // - this.chkGenerateLabel.AutoSize = true; - this.chkGenerateLabel.Location = new System.Drawing.Point(108, 19); - this.chkGenerateLabel.Name = "chkGenerateLabel"; - this.chkGenerateLabel.Size = new System.Drawing.Size(95, 17); - this.chkGenerateLabel.TabIndex = 40; - this.chkGenerateLabel.Text = "Generate label"; - this.chkGenerateLabel.UseVisualStyleBackColor = true; + this.lblEncodingTime.TabIndex = 70; // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(1, 60); + this.label3.Location = new System.Drawing.Point(5, 48); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(52, 13); - this.label3.TabIndex = 35; + this.label3.TabIndex = 65; this.label3.Text = "Encoding"; // // cbEncodeType @@ -434,50 +475,27 @@ private void InitializeComponent() "Telepen", "FIM", "Pharmacode"}); - this.cbEncodeType.Location = new System.Drawing.Point(4, 76); + this.cbEncodeType.Location = new System.Drawing.Point(7, 64); this.cbEncodeType.Name = "cbEncodeType"; this.cbEncodeType.Size = new System.Drawing.Size(108, 21); - this.cbEncodeType.TabIndex = 2; - // - // label9 + this.cbEncodeType.TabIndex = 59; // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(158, 78); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(12, 13); - this.label9.TabIndex = 51; - this.label9.Text = "x"; - // - // groupBox2 - // - this.groupBox2.Controls.Add(this.barcode); - this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; - this.groupBox2.Location = new System.Drawing.Point(0, 0); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(401, 336); - this.groupBox2.TabIndex = 36; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "Barcode Image"; - // - // splitContainer1 - // - this.splitContainer1.BackColor = System.Drawing.SystemColors.Control; - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; - this.splitContainer1.Location = new System.Drawing.Point(0, 0); - this.splitContainer1.Name = "splitContainer1"; - // - // splitContainer1.Panel1 + // txtData // - this.splitContainer1.Panel1.Controls.Add(this.groupBox1); + this.txtData.Location = new System.Drawing.Point(7, 24); + this.txtData.Name = "txtData"; + this.txtData.Size = new System.Drawing.Size(194, 20); + this.txtData.TabIndex = 58; + this.txtData.Text = "038000356216"; // - // splitContainer1.Panel2 + // label1 // - this.splitContainer1.Panel2.Controls.Add(this.groupBox2); - this.splitContainer1.Size = new System.Drawing.Size(623, 336); - this.splitContainer1.SplitterDistance = 218; - this.splitContainer1.TabIndex = 37; - this.splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.splitContainer1_SplitterMoved); + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(5, 8); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(86, 13); + this.label1.TabIndex = 63; + this.label1.Text = "Value to Encode"; // // errorProvider1 // @@ -490,21 +508,23 @@ private void InitializeComponent() this.ClientSize = new System.Drawing.Size(623, 360); this.Controls.Add(this.splitContainer1); this.Controls.Add(this.statusStrip1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.DoubleBuffered = true; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MinimumSize = new System.Drawing.Size(639, 398); this.Name = "TestApp"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Barcode Encoder"; this.Load += new System.EventHandler(this.TestApp_Load); - ((System.ComponentModel.ISupportInitialize)(this.barcode)).EndInit(); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.groupBox2.ResumeLayout(false); this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); this.splitContainer1.Panel2.ResumeLayout(false); this.splitContainer1.ResumeLayout(false); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -513,42 +533,44 @@ private void InitializeComponent() #endregion - private System.Windows.Forms.PictureBox barcode; - private System.Windows.Forms.TextBox txtEncoded; - private System.Windows.Forms.TextBox txtData; - private System.Windows.Forms.Label label1; private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.ToolStripStatusLabel tsslEncodedType; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.ComboBox cbEncodeType; - private System.Windows.Forms.Button btnEncode; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Button btnSave; - private System.Windows.Forms.Label label3; + private System.Windows.Forms.GroupBox barcode; private System.Windows.Forms.ToolStripStatusLabel tslblCredits; private System.Windows.Forms.SplitContainer splitContainer1; - private System.Windows.Forms.Button btnBackColor; - private System.Windows.Forms.Button btnForeColor; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.CheckBox chkGenerateLabel; - private System.Windows.Forms.TextBox txtHeight; + private System.Windows.Forms.ErrorProvider errorProvider1; + private System.Windows.Forms.ToolStripStatusLabel tslblLibraryVersion; + private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.TextBox txtWidth; - private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label lblEncodingTime; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox txtHeight; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.CheckBox chkGenerateLabel; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.ComboBox cbLabelLocation; + private System.Windows.Forms.Label lblLabelLocation; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.ComboBox cbRotateFlip; + private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Button btnSaveXML; private System.Windows.Forms.Button btnLoadXML; - private System.Windows.Forms.ErrorProvider errorProvider1; - private System.Windows.Forms.ToolStripStatusLabel tslblLibraryVersion; - private System.Windows.Forms.Label lblLabelLocation; - private System.Windows.Forms.ComboBox cbLabelLocation; private System.Windows.Forms.Label label8; + private System.Windows.Forms.Button btnEncode; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox txtEncoded; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Button btnBackColor; private System.Windows.Forms.ComboBox cbBarcodeAlign; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.ComboBox cbRotateFlip; + private System.Windows.Forms.Button btnForeColor; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label lblEncodingTime; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.ComboBox cbEncodeType; + private System.Windows.Forms.TextBox txtData; + private System.Windows.Forms.Label label1; } } diff --git a/BarcodeLibTest/TestApp.cs b/BarcodeLibTest/TestApp.cs index 15674a2..e19adfb 100644 --- a/BarcodeLibTest/TestApp.cs +++ b/BarcodeLibTest/TestApp.cs @@ -24,9 +24,6 @@ public TestApp() private void TestApp_Load(object sender, EventArgs e) { - Bitmap temp = new Bitmap(1, 1); - temp.SetPixel(0, 0, this.BackColor); - barcode.Image = (Image)temp; this.cbEncodeType.SelectedIndex = 0; this.cbBarcodeAlign.SelectedIndex = 0; this.cbLabelLocation.SelectedIndex = 0; @@ -117,7 +114,7 @@ private void btnEncode_Click(object sender, EventArgs e) }//switch //===== Encoding performed here ===== - barcode.Image = b.Encode(type, this.txtData.Text.Trim(), this.btnForeColor.BackColor, this.btnBackColor.BackColor, W, H); + barcode.BackgroundImage = b.Encode(type, this.txtData.Text.Trim(), this.btnForeColor.BackColor, this.btnBackColor.BackColor, W, H); //=================================== //show the encoding time @@ -128,11 +125,8 @@ private void btnEncode_Click(object sender, EventArgs e) tsslEncodedType.Text = "Encoding Type: " + b.EncodedType.ToString(); }//if - barcode.Width = barcode.Image.Width; - barcode.Height = barcode.Image.Height; - //reposition the barcode image to the middle - barcode.Location = new Point((this.groupBox2.Location.X + this.groupBox2.Width / 2) - barcode.Width / 2, (this.groupBox2.Location.Y + this.groupBox2.Height / 2) - barcode.Height / 2); + barcode.Location = new Point((this.barcode.Location.X + this.barcode.Width / 2) - barcode.Width / 2, (this.barcode.Location.Y + this.barcode.Height / 2) - barcode.Height / 2); }//try catch (Exception ex) { @@ -164,7 +158,7 @@ private void btnSave_Click(object sender, EventArgs e) private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e) { - barcode.Location = new Point((this.groupBox2.Location.X + this.groupBox2.Width / 2) - barcode.Width / 2, (this.groupBox2.Location.Y + this.groupBox2.Height / 2) - barcode.Height / 2); + barcode.Location = new Point((this.barcode.Location.X + this.barcode.Width / 2) - barcode.Width / 2, (this.barcode.Location.Y + this.barcode.Height / 2) - barcode.Height / 2); }//splitContainer1_SplitterMoved private void btnForeColor_Click(object sender, EventArgs e) @@ -224,7 +218,7 @@ private void btnLoadXML_Click(object sender, EventArgs e) //load image from xml this.barcode.Width = XML.Barcode[0].ImageWidth; this.barcode.Height = XML.Barcode[0].ImageHeight; - this.barcode.Image = BarcodeLib.Barcode.GetImageFromXML(XML); + this.barcode.BackgroundImage = BarcodeLib.Barcode.GetImageFromXML(XML); //populate the screen this.txtData.Text = XML.Barcode[0].RawData; @@ -333,11 +327,10 @@ private void btnLoadXML_Click(object sender, EventArgs e) btnEncode_Click(sender, e); //reposition the barcode image to the middle - barcode.Location = new Point((this.groupBox2.Location.X + this.groupBox2.Width / 2) - barcode.Width / 2, (this.groupBox2.Location.Y + this.groupBox2.Height / 2) - barcode.Height / 2); + barcode.Location = new Point((this.barcode.Location.X + this.barcode.Width / 2) - barcode.Width / 2, (this.barcode.Location.Y + this.barcode.Height / 2) - barcode.Height / 2); }//using }//if }//using } - }//class }//namespace \ No newline at end of file