Réponse acceptée !
Pour écrire verticalement il faut que tu passes bien evidemment par les APIs et dans un élan de générosité je vais te donner un petit bout de code ki te permet d'afficher un texte "verticalement"! J'ai retrouvé ce petit bout de code ke j'avais fait il y'a plus d'un an pour un certain pcpunch! :p
Voici donc ::
'---Les APIs
Private Declare Function GetDeviceCaps Lib "GDI32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Declare Function CreateFont Lib "GDI32" Alias "CreateFontA" (ByVal H As Long, ByVal w As Long, ByVal E As Long, ByVal O As Long, ByVal w As Long, ByVal i As Long, ByVal U As Long, ByVal S As Long, ByVal C As Long, ByVal OP As Long, ByVal CP As Long, ByVal Q As Long, ByVal PAF As Long, ByVal F As String) As Long
Private Declare Function DeleteObject Lib "GDI32" (ByVal hObject As Long) As Long
Private Declare Function TextOut Lib "GDI32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Integer, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function SetMapMode Lib "GDI32" (ByVal hdc As Long, ByVal nMapMode As Long) As Long
Private Declare Function SelectObject Lib "GDI32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Const MM_LOMETRIC = 2
Private Const LOGPIXELSY = 90
Dim HFont As Long, HFontOld As Long, MapModePrevious As Long
'---La structure de stockage du texte
Private Type TexteV
Texte As String
x As Integer
y As Integer
Police As String
Italique As Boolean
Gras As Boolean
Souligne As Boolean
Barre As Boolean
Taille As Integer
Angle As Integer
End Type
dim Texte as TexteV
'---La procédure d'affichage du texte
sub DrawAngleText()
pic.currentx=x
pic.currenty=y
with Texte
MapModePrevious = SetMapMode(Pic.hdc, MM_LOMETRIC)
HFont = CreateFont(.Taille, 0&, .Angle, .Angle, CInt(.Gras), CInt(.Italique), CInt(.Souligne), CInt(.Barre), 0&, 0&, 0&, 0&, 0&, .Police)
HFontOld = SelectObject(Pic.hdc, HFont)
TextOut Pic.hdc, 4 * .x, -4 * .y, .Texte, Len(.Texte)
SetMapMode Pic.hdc, MapModePrevious
SelectObject Pic.hdc, HFontOld
DeleteObject HFont
end with
end sub
'---Création du texte
sub Form_Load()
With Texte
.Texte = "Bonjour Madame!"
.Police = "Arial"
.Taille = Int(Rnd * 200)
.Angle = -450
.x = Int(Rnd * Pic.ScaleWidth / 2)
.y = Int(Rnd * Pic.ScaleHeight / 2)
End With
end sub
Voila tout, donc bien évidemment il te faut un picturebox de préférence a fond blanc car par défaut on écrait en noir, enfin ca c a toi de voir en changeant les propriétés forecolr et backcolor du picturebox! Donc normalement ce petit exemple marche, je l'ai retouché histoire de raccourcir ce ke j'avais déja!
Have a Good Code
#
Geff
