条形码的编码规则不外乎是通过线条和线条间间隙的宽窄不同来表示二进制的1和0,只要我们了解了条形码的编码规则,完全可以用画图的方式在普通打印机上得到可以接受的效果。下面我们就使用最普遍的CODE39码进行讨论。   CODE39码的编码规则是: 1、 每五条线表示一个字符; 2、 粗线表示1,细线表示0; 3、 线条间的间隙宽的表示1,窄的表示0; 4、 五条线加上它们之间的四条间隙就是九位二进制编码,而且这九位中必定有三位是1,所以称为39码; 5、 条形码的首尾各一个*标识开始和结束 
strBarTable(0) = "001100100"   ' 0   strBarTable(1) = "100010100"   ' 1   strBarTable(2) = "010010100"   ' 2   strBarTable(3) = "110000100"   ' 3   strBarTable(4) = "001010100"   ' 4   strBarTable(5) = "101000100"   ' 5   strBarTable(6) = "011000100"   ' 6   strBarTable(7) = "000110100"   ' 7   strBarTable(8) = "100100100"   ' 8   strBarTable(9) = "010100100"   ' 9   strBarTable(10) = "100010010"  ' A   strBarTable(11) = "010010010"  ' B   strBarTable(12) = "110000010"  ' C   strBarTable(13) = "001010010"  ' D   strBarTable(14) = "101000010"  ' E   strBarTable(15) = "011000010"  ' F   strBarTable(16) = "000110010"  ' G   strBarTable(17) = "100100010"  ' H   strBarTable(18) = "010100010"  ' I   strBarTable(19) = "001100010"  ' J   strBarTable(20) = "100010001"  ' K   strBarTable(21) = "010010001"  ' L   strBarTable(22) = "110000001"  ' M   strBarTable(23) = "001010001"  ' N   strBarTable(24) = "101000001"  ' O   strBarTable(25) = "011000001"  ' P   strBarTable(26) = "000110001"  ' Q   strBarTable(27) = "100100001"  ' R   strBarTable(28) = "010100001"  ' S   strBarTable(29) = "001100001"  ' T   strBarTable(30) = "100011000"  ' U   strBarTable(31) = "010011000"  ' V   strBarTable(32) = "110001000"  ' W   strBarTable(33) = "001011000"  ' X   strBarTable(34) = "101001000"  ' Y   strBarTable(35) = "011001000"  ' Z   strBarTable(36) = "000111000"  ' -   strBarTable(37) = "100101000"  ' %   strBarTable(38) = "010101000"  ' $   strBarTable(39) = "001101000"  ' *