IMPRIMIR CODIGO DE BARRAS NA PICTURE

NICOLLAS2 24/03/2010 13:58:49
#337807
galera, use a seguinte instrução para emitir codigo de barras

Citação:

Dim pic As PictureBox
Dim zz1 As Variant
Dim zz2 As Variant

Private Sub Form_Load()
[ô][ô]Set pic = PicBarCode
zz1 = Split([Ô]0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,-,.,SP,$,/,+,%,*[Ô], [Ô],[Ô])
zz2 = Split([Ô]111221211,211211112,112211112,212211111,111221112,211221111,112221111,111211212,211211211, _112211211,211112112,112112112,212112111,111122112,211122111,112122111,111112212,211112211,112112211,111122211,211111122,112111122,212111121,111121122,211121121,112121121,111111222,211111221,112111221,111121221,221111112,122111112,222111111,121121112,221121111,122121111,121111212,221111211,122111211,121212111,121211121,121112121,111212121,121121211[Ô], [Ô],[Ô])

[ô]IMPRIME CODIGO DE BARRAS
Dim bc4(0 To 20) As String
Dim barchar As String
Dim barcolor As Boolean
Dim X As String
Dim Sclr As Single
Dim bs As Single
Dim bwn As Single
Dim ac As Integer
Dim s As Integer
Dim bct As Integer
Dim bcl As Integer
ac = 1
Sclr = 20
X = 2541
bc4(ac - 1) = [Ô]121121211[Ô]
For bct = 1 To Len(X)
barchar = Mid(X, bct, 1)
If barchar = [Ô] [Ô] Then barchar = [Ô]SP[Ô]
For s = 0 To UBound(zz1)
If UCase(barchar) = zz1(s) Then
bc4(ac) = zz2(s)
ac = ac + 1
Exit For
End If
Next s
Next bct
bc4(ac) = [Ô]121121211[Ô]
bs = 0
Printer.CurrentX = 100
For bct = 0 To ac
X = bc4(bct)
barcolor = True
For s = 1 To Len(X)
bwn = (Val(Mid(X, s, 1))) * Sclr
If barcolor = True Then
Printer.Line (bs, 250)-Step(bwn, 400), vbBlack, BF
End If
barcolor = IIf(barcolor = True, False, True)
bs = bs + bwn
Next s
bs = bs + Sclr
Next bct


End Sub

Private Sub GeraCodBar39(X As String, Sclr As Integer)
Dim bc4(0 To 20) As String
Dim barchar As String
Dim barcolor As String
Dim bs As Single
Dim bwn As Single
Dim ac As Integer
Dim s As Integer
Dim bct As Integer
Dim bcl As Integer
ac = 1
pic.Cls
bc4(ac - 1) = [Ô]121121211[Ô]
For bct = 1 To Len(X)
barchar = Mid(X, bct, 1)
If barchar = [Ô] [Ô] Then barchar = [Ô]SP[Ô]
For s = 0 To UBound(zz1)
If UCase(barchar) = zz1(s) Then
bc4(ac) = zz2(s)
ac = ac + 1
Exit For
End If
Next s
Next bct
bc4(ac) = [Ô]121121211[Ô]
bs = 200
pic.DrawWidth = 1
For bct = 0 To ac
X = bc4(bct)
barcolor = vbBlack
For s = 1 To Len(X)
bwn = (Val(Mid(X, s, 1))) * Sclr
For bcl = 1 To bwn
pic.Line (bs + bcl, 100)-Step(0, 1200), barcolor
Next bcl
If barcolor = vbBlack Then barcolor = vbWhite Else barcolor = vbBlack
bs = bs + bwn
Next s
For bcl = 1 To Sclr
pic.Line (bs + bcl, 100)-Step(0, 1200), vbWhite
Next bcl
bs = bs + bcl
Next bct
pic.FontSize = 16: pic.CurrentX = 200: pic.CurrentY = 1400: pic.Print UCase(NumOs)



ate ai tudo bem... agora como faço desta mesma forma para ele imprimir numa picture?
a linha que manda a impressao é esta
Citação:

Printer.Line (bs, 250)-Step(bwn, 400), vbBlack, BF

ERIVELTONVGA 24/03/2010 14:03:33
#337810
me corrijam seu eu estiver errado pois sou iniciante ainda beleza... mas tente assim no caso de uma PICTURE

[txt-color=#e80000] Printer.PaintPicture (bs, 250)-Step(bwn, 400), vbBlack, BF [/txt-color]


espero que eu esteja certo e possa ter ajudado.
NICOLLAS2 24/03/2010 14:11:34
#337811
nao da certo, da erro expected =
ERIVELTONVGA 24/03/2010 14:29:35
#337813
nicollas entao da uma olhada nestas dicas de impressao do site do macoratti

http://www.macoratti.net/vb_print2.htm

beleza
NICOLLAS2 24/03/2010 14:35:01
#337814
nao quero imprimir no papel... quero exibir num picture
ERIVELTONVGA 24/03/2010 14:49:20
#337815
me descula eu tinha entendido errado, tinha entendido que era para imprimir e nao para gerar a imagem, aí entao fico devendo.

Tópico encerrado , respostas não são mais permitidas