📄 barcodepdf417.cs
字号:
/////////////////aTiRuZ iNC./////////////////namespace aTiRuZ.PDF417{ using Microsoft.Win32; using System.ComponentModel.Design.Serialization; using System.ComponentModel; using System.Drawing.Imaging; using System.Drawing; using System; using System.Windows.Forms; [System.Drawing.ToolboxBitmap (typeof (aTiRuZ.PDF417.BarcodePDF417))][DefaultEvent ("Load")] [DefaultProperty ("Text")] public class BarcodePDF417 : System.Windows.Forms.UserControl, System.Windows.Forms.IContainerControl, System.Windows.Forms.IWin32Window, System.ComponentModel.ISynchronizeInvoke, System.IDisposable, System.ComponentModel.IComponent { #region Fields private Container components; private short m_Rows; private short m_RuntimeRows; private short m_Columns; private float m_XtoYRatio; private enumBorderStyle m_BorderStyle; private enumSecurity m_ErrorCorrectionLevel; private short m_SecurityLevel; private enumOrientation m_Orientation; private float m_ModuleWidth; private Color m_BackColor; private Color m_BarColor; private string m_Data; private char[] m_CharArray; private short m_CurrX; private short m_CurrY; private short m_NarrowBarPixels; private short m_WideBarPixels; private short m_TopMargainPixels; private short m_BarHeightPixels; private short m_ModuleHeightPixels; private short m_LeftMargainPixels; private short m_HeightPixels; private short m_WidthPixels; private bool m_FirstDraw; private bool m_TruncatedSymbol; private ushort[] encoded_buf; private ushort[] m_EncodedData; private ushort[] m_ECCodes; private ushort m_CountAferEncode; private SolidBrush m_BarBrush; private SolidBrush m_BackBrush; private Pen m_Pen; private Graphics g; private short m_LeftPixels; private short m_TopPixels; private float m_ResX; private float m_ResY; private static readonly string[,] textCodes; private static readonly short[] coef0; private static readonly short[] coef1; private static readonly short[] coef2; private static readonly short[] coef3; private static readonly short[] coef4; private static readonly short[] coef5; private static readonly short[] coef6; private static readonly short[] coef7; private static readonly short[] coef8; private static readonly int[,] PDF417_BITS; #endregion #region Constructors public BarcodePDF417 () { this.components = null; this.m_Rows = 30; this.m_Columns = 13; this.m_XtoYRatio = 4F; this.m_BorderStyle = enumBorderStyle.bsNoBorder; this.m_ErrorCorrectionLevel = enumSecurity.seLevel_5; this.m_SecurityLevel = 5; this.m_Orientation = enumOrientation.or0; this.m_ModuleWidth = 0.019F; this.m_BackColor = Color.White; this.m_BarColor = Color.Black; this.m_Data = "aTiRuZ"; this.m_CurrX = 0; this.m_CurrY = 0; this.m_NarrowBarPixels = 0; this.m_WideBarPixels = 0; this.m_TopMargainPixels = 0; this.m_BarHeightPixels = 0; this.m_ModuleHeightPixels = 0; this.m_LeftMargainPixels = 0; this.m_HeightPixels = 0; this.m_WidthPixels = 0; this.encoded_buf = new ushort[3000]; this.m_EncodedData = new ushort[3000]; this.m_ECCodes = new ushort[3000]; this.m_Pen = Pens.Black; base.BackColor = Color.White; base.ForeColor = Color.Black; base.Width = 400; base.Height = 300; this.InitializeComponent (); } static BarcodePDF417 () { short[] theInt16Array1; string[,] theStringArray1; theStringArray1 = new string [95, 2]; theStringArray1[0, 0] = " "; theStringArray1[0, 1] = "C26"; theStringArray1[1, 0] = "!"; theStringArray1[1, 1] = "D10"; theStringArray1[2, 0] = "\\"; theStringArray1[2, 1] = "D5"; theStringArray1[3, 0] = "#"; theStringArray1[3, 1] = "C15"; theStringArray1[4, 0] = "$"; theStringArray1[4, 1] = "C18"; theStringArray1[5, 0] = "%"; theStringArray1[5, 1] = "C21"; theStringArray1[6, 0] = "&"; theStringArray1[6, 1] = "C10"; theStringArray1[7, 0] = "\'"; theStringArray1[7, 1] = "D28"; theStringArray1[8, 0] = "("; theStringArray1[8, 1] = "D23"; theStringArray1[9, 0] = ")"; theStringArray1[9, 1] = "D24"; theStringArray1[10, 0] = "*"; theStringArray1[10, 1] = "C22"; theStringArray1[11, 0] = "+"; theStringArray1[11, 1] = "C20"; theStringArray1[12, 0] = ","; theStringArray1[12, 1] = "C13"; theStringArray1[13, 0] = "-"; theStringArray1[13, 1] = "C16"; theStringArray1[14, 0] = "."; theStringArray1[14, 1] = "C17"; theStringArray1[15, 0] = "/"; theStringArray1[15, 1] = "C19"; theStringArray1[16, 0] = "0"; theStringArray1[16, 1] = "C0"; theStringArray1[17, 0] = "1"; theStringArray1[17, 1] = "C1"; theStringArray1[18, 0] = "2"; theStringArray1[18, 1] = "C2"; theStringArray1[19, 0] = "3"; theStringArray1[19, 1] = "C3"; theStringArray1[20, 0] = "4"; theStringArray1[20, 1] = "C4"; theStringArray1[21, 0] = "5"; theStringArray1[21, 1] = "C5"; theStringArray1[22, 0] = "6"; theStringArray1[22, 1] = "C6"; theStringArray1[23, 0] = "7"; theStringArray1[23, 1] = "C7"; theStringArray1[24, 0] = "8"; theStringArray1[24, 1] = "C8"; theStringArray1[25, 0] = "9"; theStringArray1[25, 1] = "C9"; theStringArray1[26, 0] = ":"; theStringArray1[26, 1] = "C14"; theStringArray1[27, 0] = ";"; theStringArray1[27, 1] = "D0"; theStringArray1[28, 0] = "<"; theStringArray1[28, 1] = "D1"; theStringArray1[29, 0] = "="; theStringArray1[29, 1] = "C23"; theStringArray1[30, 0] = ">"; theStringArray1[30, 1] = "D2"; theStringArray1[31, 0] = "?"; theStringArray1[31, 1] = "D25"; theStringArray1[32, 0] = "@"; theStringArray1[32, 1] = "D3"; theStringArray1[33, 0] = "A"; theStringArray1[33, 1] = "A0"; theStringArray1[34, 0] = "B"; theStringArray1[34, 1] = "A1"; theStringArray1[35, 0] = "C"; theStringArray1[35, 1] = "A2"; theStringArray1[36, 0] = "D"; theStringArray1[36, 1] = "A3"; theStringArray1[37, 0] = "E"; theStringArray1[37, 1] = "A4"; theStringArray1[38, 0] = "F"; theStringArray1[38, 1] = "A5"; theStringArray1[39, 0] = "G"; theStringArray1[39, 1] = "A6"; theStringArray1[40, 0] = "H"; theStringArray1[40, 1] = "A7"; theStringArray1[41, 0] = "I"; theStringArray1[41, 1] = "A8"; theStringArray1[42, 0] = "J"; theStringArray1[42, 1] = "A9"; theStringArray1[43, 0] = "K"; theStringArray1[43, 1] = "A10"; theStringArray1[44, 0] = "L"; theStringArray1[44, 1] = "A11"; theStringArray1[45, 0] = "M"; theStringArray1[45, 1] = "A12"; theStringArray1[46, 0] = "N"; theStringArray1[46, 1] = "A13"; theStringArray1[47, 0] = "O"; theStringArray1[47, 1] = "A14"; theStringArray1[48, 0] = "P"; theStringArray1[48, 1] = "A15"; theStringArray1[49, 0] = "Q"; theStringArray1[49, 1] = "A16"; theStringArray1[50, 0] = "R"; theStringArray1[50, 1] = "A17"; theStringArray1[51, 0] = "S"; theStringArray1[51, 1] = "A18"; theStringArray1[52, 0] = "T"; theStringArray1[52, 1] = "A19"; theStringArray1[53, 0] = "U"; theStringArray1[53, 1] = "A20"; theStringArray1[54, 0] = "V"; theStringArray1[54, 1] = "A21"; theStringArray1[55, 0] = "W"; theStringArray1[55, 1] = "A22"; theStringArray1[56, 0] = "X"; theStringArray1[56, 1] = "A23"; theStringArray1[57, 0] = "Y"; theStringArray1[57, 1] = "A24"; theStringArray1[58, 0] = "Z"; theStringArray1[58, 1] = "A25"; theStringArray1[59, 0] = "["; theStringArray1[59, 1] = "D4"; theStringArray1[60, 0] = "\""; theStringArray1[60, 1] = "D20"; theStringArray1[61, 0] = "]"; theStringArray1[61, 1] = "D6"; theStringArray1[62, 0] = "^"; theStringArray1[62, 1] = "C24"; theStringArray1[63, 0] = "_"; theStringArray1[63, 1] = "D7"; theStringArray1[64, 0] = "`"; theStringArray1[64, 1] = "D8"; theStringArray1[65, 0] = "a"; theStringArray1[65, 1] = "B0"; theStringArray1[66, 0] = "b"; theStringArray1[66, 1] = "B1"; theStringArray1[67, 0] = "c"; theStringArray1[67, 1] = "B2"; theStringArray1[68, 0] = "d"; theStringArray1[68, 1] = "B3"; theStringArray1[69, 0] = "e"; theStringArray1[69, 1] = "B4"; theStringArray1[70, 0] = "f"; theStringArray1[70, 1] = "B5"; theStringArray1[71, 0] = "g"; theStringArray1[71, 1] = "B6"; theStringArray1[72, 0] = "h"; theStringArray1[72, 1] = "B7"; theStringArray1[73, 0] = "i"; theStringArray1[73, 1] = "B8"; theStringArray1[74, 0] = "j"; theStringArray1[74, 1] = "B9"; theStringArray1[75, 0] = "k"; theStringArray1[75, 1] = "B10"; theStringArray1[76, 0] = "l"; theStringArray1[76, 1] = "B11"; theStringArray1[77, 0] = "m"; theStringArray1[77, 1] = "B12"; theStringArray1[78, 0] = "n"; theStringArray1[78, 1] = "B13"; theStringArray1[79, 0] = "o"; theStringArray1[79, 1] = "B14"; theStringArray1[80, 0] = "p"; theStringArray1[80, 1] = "B15"; theStringArray1[81, 0] = "q"; theStringArray1[81, 1] = "B16"; theStringArray1[82, 0] = "r"; theStringArray1[82, 1] = "B17"; theStringArray1[83, 0] = "s"; theStringArray1[83, 1] = "B18"; theStringArray1[84, 0] = "t"; theStringArray1[84, 1] = "B19"; theStringArray1[85, 0] = "u"; theStringArray1[85, 1] = "B20"; theStringArray1[86, 0] = "v"; theStringArray1[86, 1] = "B21"; theStringArray1[87, 0] = "w"; theStringArray1[87, 1] = "B22"; theStringArray1[88, 0] = "x"; theStringArray1[88, 1] = "B23"; theStringArray1[89, 0] = "y"; theStringArray1[89, 1] = "B24"; theStringArray1[90, 0] = "z"; theStringArray1[90, 1] = "B25"; theStringArray1[91, 0] = "{"; theStringArray1[91, 1] = "D26"; theStringArray1[92, 0] = "|"; theStringArray1[92, 1] = "D21"; theStringArray1[93, 0] = "}"; theStringArray1[93, 1] = "D27"; theStringArray1[94, 0] = "~"; theStringArray1[94, 1] = "D9"; BarcodePDF417.textCodes = theStringArray1; theInt16Array1 = new short[] { 27, 917 }; BarcodePDF417.coef0 = theInt16Array1; BarcodePDF417.coef1 = new short[] { 522, 568, 723, 809 }; BarcodePDF417.coef2 = new short[] { 237, 308, 436, 284, 646, 653, 428, 379 }; BarcodePDF417.coef3 = new short[] { 274, 562, 232, 755, 599, 524, 801, 132, 295, 116, 442, 428, 295, 42, 176, 65 }; BarcodePDF417.coef4 = new short[] { 361, 575, 922, 525, 176, 586, 640, 321, 536, 742, 677, 742, 687, 284, 193, 517, 273, 494, 263, 147, 593, 800, 571, 320, 803, 133, 231, 390, 685, 330, 63, 410 }; BarcodePDF417.coef5 = new short[] { 539, 422, 6, 93, 862, 771, 453, 106, 610, 287, 107, 505, 733, 877, 381, 612, 723, 476, 462, 172, 430, 609, 858, 822, 543, 376, 511, 400, 672, 762, 283, 184, 440, 35, 519, 31, 460, 594, 225, 535, 517, 352, 605, 158, 651, 201, 488, 502, 648, 733, 717, 83, 404, 97, 280, 771, 840, 629, 4, 381, 843, 623, 264, 543 }; BarcodePDF417.coef6 = new short[] { 521, 310, 864, 547, 858, 580, 296, 379, 53, 779, 897, 444, 400, 925, 749, 415, 822, 93, 217, 208, 928, 244, 583, 620, 246, 148, 447, 631, 292, 908, 490, 704, 516, 258, 457, 907, 594, 723, 674, 292, 272, 96, 684, 432, 686, 606, 860, 569, 193, 219, 129, 186, 236, 287, 192, 775, 278, 173, 40, 379, 712, 463, 646, 776, 171, 491, 297, 763, 156, 732, 95, 270, 447, 90, 507, 48, 228, 821, 808, 898, 784, 663, 627, 378, 382, 262, 380, 602, 754, 336, 89, 614, 87, 432, 670, 616, 157, 374, 242, 726, 600, 269, 375, 898, 845, 454, 354, 130, 814, 587, 804, 34, 211, 330, 539, 297, 827, 865, 37, 517, 834, 315, 550, 86, 801, 4, 108, 539 }; BarcodePDF417.coef7 = new short[] { 524, 894, 75, 766, 882, 857, 74, 204, 82, 586, 708, 250, 905, 786, 138, 720, 858, 194, 311, 913, 275, 190, 375, 850, 438, 733, 194, 280, 201, 280, 828, 757, 710, 814, 919, 89, 68, 569, 11, 204, 796, 605, 540, 913, 801, 700, 799, 137, 439, 418, 592, 668, 353, 859, 370, 694, 325, 240, 216, 257, 284, 549, 209, 884, 315, 70, 329, 793, 490, 274, 877, 162, 749, 812, 684, 461, 334, 376, 849, 521, 307, 291, 803, 712, 19, 358, 399, 908, 103, 511, 51, 8, 517, 225, 289, 470, 637, 731, 66, 255, 917, 269, 463, 830, 730, 433, 848, 585, 136, 538, 906, 90, 2, 290, 743, 199, 655, 903, 329, 49, 802, 580, 355, 588, 188, 462, 10, 134, 628, 320, 479, 130, 739, 71, 263, 318, 374, 601, 192, 605, 142, 673, 687, 234, 722, 384, 177, 752, 607, 640, 455, 193, 689, 707, 805, 641, 48, 60, 732, 621, 895, 544, 261, 852, 655, 309, 697, 755, 756, 60, 231, 773, 434, 421, 726, 528, 503, 118, 49, 795,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -