2
I have the code below that generates me a copy of bars from a number inserted, but I think that the bars are very close, there is a way to leave them with a larger spacing between them?
below the code:
const digitos : array['0'..'9'] of string[5]= ('00110', '10001', '01001', '11000', '00101', '10100', '01100', '00011', '10010', '01010');
var s : string; i, j, x, t : Integer;
begin // Gerar o valor para desenhar o código de barras //
s := '0000';
for i := 1 to length(codigo)div 2 do
for j := 1 to 5 do s := s + Copy(Digitos[codigo[i * 2 - 1]], j, 1) + Copy(Digitos[codigo[i * 2]], j, 1);
s := s + '100';
x := 0;
Canvas.Brush.Color := clWhite;
Canvas.Pen.Color := clWhite;
Canvas.Rectangle(0,0, 2000, 79);
Canvas.Brush.Color := clBlack;
Canvas.Pen.Color := clBlack;
for i := 1 to length(s) do
begin
t := strToInt(s[i]) * 3 + 1;
if i mod 2 = 1 then
Canvas.Rectangle(x, 0, x + t, 67);
x := x + t;
end;
end;