OVH Cloud OVH Cloud

Imprimer en diagonale

4 réponses
Avatar
enoladas
Bonjour,

en VB6, comment puis-je écrire un texte en diagonale sur un objet Printer ?

Merci d'avance !

4 réponses

Avatar
ng
Salut,

Comme dans une picturebox :

Private Declare Function CreateFontIndirect Lib "gdi32" Alias
"CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
Option Explicit

Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal
hObject As Long) As Long
Private Const LF_FACESIZE = 32
Private Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(LF_FACESIZE) As Byte
End Type


Private Sub Form_Load()
Dim RotateMe As LOGFONT
Dim lDeg As Long, lSize As Long

lDeg = 315: lSize = 20
RotateMe.lfEscapement = lDeg * 10
RotateMe.lfHeight = (lSize * -20) / Screen.TwipsPerPixelY
rFont = CreateFontIndirect(RotateMe)
Curent = SelectObject(Printer.hdc, rFont)

Printer.CurrentX = 500
Printer.CurrentY = 200
Printer.Print "Test"

Call Printer.EndDoc
End Sub



--
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/
http://apisvb.europe.webmatrixhosting.net/



enoladas a écrit :

Bonjour,

en VB6, comment puis-je écrire un texte en diagonale sur un objet
Printer ?

Merci d'avance !


Avatar
myname
"ng" a écrit dans le message news:

Salut,

Comme dans une picturebox :

Private Declare Function CreateFontIndirect Lib "gdi32" Alias
"CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
Option Explicit



Bonjour,

merci pour l'aide.

C'est la méthode que j'avais utilisé mais le texte finit toujours horizontal
:c(

Une autre idée ?
Avatar
ng
Salut,

Il suffit de ruser un peu :

Option Explicit

Private Declare Function CreateFontIndirect Lib "gdi32" Alias
"CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal
hObject As Long) As Long
Private Const LF_FACESIZE = 32
Private Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(LF_FACESIZE) As Byte
End Type


Private Sub Form_Load()

Picture1.AutoRedraw = True
Picture1.BackColor = vbWhite
Call Picture1.Cls

Dim RotateMe As LOGFONT
Dim lDeg As Long, lSize As Long

lDeg = 315: lSize = 20
RotateMe.lfEscapement = lDeg * 10
RotateMe.lfHeight = (lSize * -20) / Screen.TwipsPerPixelY
Call SelectObject(Picture1.hdc, CreateFontIndirect(RotateMe))

Picture1.CurrentX = 500
Picture1.CurrentY = 200
Picture1.Print "Test"

Call Printer.PaintPicture(Picture1.Image, 0, 0)

Call Printer.EndDoc
End Sub



--
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/
http://apisvb.europe.webmatrixhosting.net/



myname a écrit :

"ng" a écrit dans le message news:

Salut,

Comme dans une picturebox :

Private Declare Function CreateFontIndirect Lib "gdi32" Alias
"CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
Option Explicit



Bonjour,

merci pour l'aide.

C'est la méthode que j'avais utilisé mais le texte finit toujours
horizontal
c(



Une autre idée ?


Avatar
myname
"ng" a écrit dans le message news:
OR#
Salut,

Il suffit de ruser un peu :



Merci beaucoup, c'est la piste que j'étais en train d'explorer... avec un
succès moins immédiat :c)