Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
ng
Salut, Voici un exemple de code :
Public Sub ImprimeOb(sTxt As String, oDest As Object, pZoom As Double, lTaille As Long, sPolice As String) On Error GoTo errH Dim i As Integer, sLignes() As String oDest.ScaleMode = vbCentimeters oDest.FontName = sPolice oDest.FontSize = lTaille * pZoom If TypeOf oDest Is PictureBox Then oDest.Cls sLignes = Split(sTxt, vbCrLf, , vbTextCompare) 'CENTRE 'oDest.CurrentY = (oDest.ScaleHeight - oDest.TextHeight(sTxt)) / 2 'GAUCHE oDest.CurrentY = 0 For i = 0 To UBound(sLignes) 'CENTRE 'oDest.CurrentX = (oDest.ScaleWidth - oDest.TextWidth(sTxt)) / 2 oDest.CurrentX = 0 oDest.Print sLignes(i) Next Erase sLignes Exit Sub errH:: MsgBox Err.Description, vbCritical, "Erreur n°" & Err.Number End Sub
A appeler par :
Pour un apercu : Call ImprimeOb(Text1.Text, Picture1, 1, 8, "Verdana")
Pour une impression : Call ImprimeOb(Text1.Text, Printer, 1, 8, "Verdana") Call Printer.EndDoc -- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
"François ROLAND" a écrit dans le message de news: eR$
Lorsque j'utilise un controle texte sur plusieur ligne, voudrai pouvoir l'imprimer suivant la meme presentation. Comment puis je faire?
Cordialement
--
François ROLAND
Salut,
Voici un exemple de code :
Public Sub ImprimeOb(sTxt As String, oDest As Object, pZoom As Double,
lTaille As Long, sPolice As String)
On Error GoTo errH
Dim i As Integer, sLignes() As String
oDest.ScaleMode = vbCentimeters
oDest.FontName = sPolice
oDest.FontSize = lTaille * pZoom
If TypeOf oDest Is PictureBox Then oDest.Cls
sLignes = Split(sTxt, vbCrLf, , vbTextCompare)
'CENTRE
'oDest.CurrentY = (oDest.ScaleHeight - oDest.TextHeight(sTxt)) / 2
'GAUCHE
oDest.CurrentY = 0
For i = 0 To UBound(sLignes)
'CENTRE
'oDest.CurrentX = (oDest.ScaleWidth - oDest.TextWidth(sTxt)) / 2
oDest.CurrentX = 0
oDest.Print sLignes(i)
Next
Erase sLignes
Exit Sub
errH::
MsgBox Err.Description, vbCritical, "Erreur n°" & Err.Number
End Sub
A appeler par :
Pour un apercu :
Call ImprimeOb(Text1.Text, Picture1, 1, 8, "Verdana")
Pour une impression :
Call ImprimeOb(Text1.Text, Printer, 1, 8, "Verdana")
Call Printer.EndDoc
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
"François ROLAND" <francois.roland@free.fr> a écrit dans le message de news:
eR$UHdb6DHA.1556@tk2msftngp13.phx.gbl...
Lorsque j'utilise un controle texte sur plusieur ligne, voudrai pouvoir
l'imprimer suivant la meme presentation. Comment puis je faire?
Public Sub ImprimeOb(sTxt As String, oDest As Object, pZoom As Double, lTaille As Long, sPolice As String) On Error GoTo errH Dim i As Integer, sLignes() As String oDest.ScaleMode = vbCentimeters oDest.FontName = sPolice oDest.FontSize = lTaille * pZoom If TypeOf oDest Is PictureBox Then oDest.Cls sLignes = Split(sTxt, vbCrLf, , vbTextCompare) 'CENTRE 'oDest.CurrentY = (oDest.ScaleHeight - oDest.TextHeight(sTxt)) / 2 'GAUCHE oDest.CurrentY = 0 For i = 0 To UBound(sLignes) 'CENTRE 'oDest.CurrentX = (oDest.ScaleWidth - oDest.TextWidth(sTxt)) / 2 oDest.CurrentX = 0 oDest.Print sLignes(i) Next Erase sLignes Exit Sub errH:: MsgBox Err.Description, vbCritical, "Erreur n°" & Err.Number End Sub
A appeler par :
Pour un apercu : Call ImprimeOb(Text1.Text, Picture1, 1, 8, "Verdana")
Pour une impression : Call ImprimeOb(Text1.Text, Printer, 1, 8, "Verdana") Call Printer.EndDoc -- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
"François ROLAND" a écrit dans le message de news: eR$
Lorsque j'utilise un controle texte sur plusieur ligne, voudrai pouvoir l'imprimer suivant la meme presentation. Comment puis je faire?
Cordialement
--
François ROLAND
François ROLAND
Super, Merci
"ng" a écrit dans le message de news:
Salut, Voici un exemple de code :
Public Sub ImprimeOb(sTxt As String, oDest As Object, pZoom As Double, lTaille As Long, sPolice As String) On Error GoTo errH Dim i As Integer, sLignes() As String oDest.ScaleMode = vbCentimeters oDest.FontName = sPolice oDest.FontSize = lTaille * pZoom If TypeOf oDest Is PictureBox Then oDest.Cls sLignes = Split(sTxt, vbCrLf, , vbTextCompare) 'CENTRE 'oDest.CurrentY = (oDest.ScaleHeight - oDest.TextHeight(sTxt)) / 2 'GAUCHE oDest.CurrentY = 0 For i = 0 To UBound(sLignes) 'CENTRE 'oDest.CurrentX = (oDest.ScaleWidth - oDest.TextWidth(sTxt)) / 2 oDest.CurrentX = 0 oDest.Print sLignes(i) Next Erase sLignes Exit Sub errH:: MsgBox Err.Description, vbCritical, "Erreur n°" & Err.Number End Sub
A appeler par :
Pour un apercu : Call ImprimeOb(Text1.Text, Picture1, 1, 8, "Verdana")
Pour une impression : Call ImprimeOb(Text1.Text, Printer, 1, 8, "Verdana") Call Printer.EndDoc -- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
"François ROLAND" a écrit dans le message de
news:
eR$ > Lorsque j'utilise un controle texte sur plusieur ligne, voudrai pouvoir > l'imprimer suivant la meme presentation. Comment puis je faire? > > Cordialement > > -- > > François ROLAND > > >
Super, Merci
"ng" <ng@ngsoft-fr.com> a écrit dans le message de news:
O5xMWqb6DHA.488@TK2MSFTNGP12.phx.gbl...
Salut,
Voici un exemple de code :
Public Sub ImprimeOb(sTxt As String, oDest As Object, pZoom As Double,
lTaille As Long, sPolice As String)
On Error GoTo errH
Dim i As Integer, sLignes() As String
oDest.ScaleMode = vbCentimeters
oDest.FontName = sPolice
oDest.FontSize = lTaille * pZoom
If TypeOf oDest Is PictureBox Then oDest.Cls
sLignes = Split(sTxt, vbCrLf, , vbTextCompare)
'CENTRE
'oDest.CurrentY = (oDest.ScaleHeight - oDest.TextHeight(sTxt)) / 2
'GAUCHE
oDest.CurrentY = 0
For i = 0 To UBound(sLignes)
'CENTRE
'oDest.CurrentX = (oDest.ScaleWidth - oDest.TextWidth(sTxt)) / 2
oDest.CurrentX = 0
oDest.Print sLignes(i)
Next
Erase sLignes
Exit Sub
errH::
MsgBox Err.Description, vbCritical, "Erreur n°" & Err.Number
End Sub
A appeler par :
Pour un apercu :
Call ImprimeOb(Text1.Text, Picture1, 1, 8, "Verdana")
Pour une impression :
Call ImprimeOb(Text1.Text, Printer, 1, 8, "Verdana")
Call Printer.EndDoc
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
"François ROLAND" <francois.roland@free.fr> a écrit dans le message de
news:
eR$UHdb6DHA.1556@tk2msftngp13.phx.gbl...
> Lorsque j'utilise un controle texte sur plusieur ligne, voudrai pouvoir
> l'imprimer suivant la meme presentation. Comment puis je faire?
>
> Cordialement
>
> --
>
> François ROLAND
> francois.roland@free.fr
>
>
Public Sub ImprimeOb(sTxt As String, oDest As Object, pZoom As Double, lTaille As Long, sPolice As String) On Error GoTo errH Dim i As Integer, sLignes() As String oDest.ScaleMode = vbCentimeters oDest.FontName = sPolice oDest.FontSize = lTaille * pZoom If TypeOf oDest Is PictureBox Then oDest.Cls sLignes = Split(sTxt, vbCrLf, , vbTextCompare) 'CENTRE 'oDest.CurrentY = (oDest.ScaleHeight - oDest.TextHeight(sTxt)) / 2 'GAUCHE oDest.CurrentY = 0 For i = 0 To UBound(sLignes) 'CENTRE 'oDest.CurrentX = (oDest.ScaleWidth - oDest.TextWidth(sTxt)) / 2 oDest.CurrentX = 0 oDest.Print sLignes(i) Next Erase sLignes Exit Sub errH:: MsgBox Err.Description, vbCritical, "Erreur n°" & Err.Number End Sub
A appeler par :
Pour un apercu : Call ImprimeOb(Text1.Text, Picture1, 1, 8, "Verdana")
Pour une impression : Call ImprimeOb(Text1.Text, Printer, 1, 8, "Verdana") Call Printer.EndDoc -- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
"François ROLAND" a écrit dans le message de
news:
eR$ > Lorsque j'utilise un controle texte sur plusieur ligne, voudrai pouvoir > l'imprimer suivant la meme presentation. Comment puis je faire? > > Cordialement > > -- > > François ROLAND > > >