Barcode Generation Code (CODE39 code)

Source: Internet
Author: User
Tags hash

"Code 39 barcode Introduction"

Code39 bar code can represent letters, numbers and other symbols a total of 43 characters: A-Z, 0-9,-.$/+%, space and so on, its main features are as follows:
The length of the bar code can be changed
The "*" number is usually used as the starting and terminating character
Check code not
Code density is between 3-9.4 characters per inch
The white space is 10 times times the width of the strip.
For industry, books, and ticket automation management

39 yards is a barcode that the Intermec company introduced in 1975, it can represent numbers, English letters, and "-", ".", "/", "", "%", "$", "" "(spaces), and" * "altogether 44 symbols, where" * "is only the start and Terminator characters.
39 yards has the characteristics of simple coding rules, low BER, and many characters, so it is widely used in every field. China has also formulated the corresponding national standards (GB12908-91).
The 39 yards have only two cell widths--wide and narrow units respectively. Wide element This width is 1 to 3 times times of narrow element, generally choose twice times, 2.5 times times or 3 times times more. Each barcode character of 39 yards is made up of nine units, of which three are wide and the remainder are narrow and therefore called 39 yards.
Some libraries in China use a special calibration character of 39 yards, and the barcode software can be printed for 39 yards of the library.

Original code: Lovlypuppy

The implementation of this function is divided into two classes, the first class DrawImageBord.cs using System.Drawing;
Using System.Drawing.Imaging;
Public abstract class Drawimagebord
... {
Protected virtual String Bordrulename
... {
Get ... {return string.   Empty; }
}

Protected virtual System.Collections.Hashtable Roles
... {
Get ...   {return new System.Collections.Hashtable (); }
}

String drawstring;
int width = 800; Width of canvas (computable)
int height = 36;//1cm
int unitwidth = 1; //

int currentlocation = 0;

Public Drawimagebord (String s)
... {
DrawString = s;
}

public virtual void Draw (System.IO.Stream target)
... {
Bitmap BM = new Bitmap (width, height);
Graphics g = graphics.fromimage (BM);
G.smoothingmode = System.Drawing.Drawing2D.SmoothingMode.Default;
G.textrenderinghint = System.Drawing.Text.TextRenderingHint.AntiAlias;

setting of canvas and Edge
G.clear (Color.White);

G.drawrectangle (pens.white, 0, 0, width, height);
for (int i = 0;   i < drawstring.length; i++)
... {
This. DrawString (Drawstring[i]. ToString (), g);
}
Bm. Save (target, imageformat.jpeg);
}
protected virtual void drawstring (string s, Graphics g)
... {
System.Collections.Hashtable hash = this. Roles;
Object o = Hash[s];
if (o = = null) return;
char[] chars = o.tostring (). ToCharArray ();
if (chars. Length > 9) return;
SolidBrush Blackbrush = new SolidBrush (color.black);
SolidBrush Witebrush = new SolidBrush (color.white);

for (int i = 0;   I < 5; i++)
... {
Draw the first 0 black strips

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.