Font

Talboum Messages postés 16 Date d'inscription mardi 31 octobre 2000 Statut Membre Dernière intervention 18 novembre 2009 - 3 mai 2009 à 00:00
PCPT Messages postés 13280 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 - 3 mai 2009 à 10:58
Bonjour,

Je débute en VB.

J'aimerais récupérer les polices de caractères installées dans mon word (dans mon windows en fait) pour les mettre dans une liste.

Une petite piste pour m'aider ? Un tout grand merci.

Miss Talboum

2 réponses

cs_ghuysmans99 Messages postés 3983 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 16
3 mai 2009 à 00:07
' Visual Basic 6.0
Dim i As Integer
For i = 0 To Screen.FontCount – 1
List1.AddItem Screen.Fonts(i)
Next i
0
PCPT Messages postés 13280 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 48
3 mai 2009 à 10:58
salut,



<hr />
'    LISTER LA POLICE D'ECRITURE
'    http://www.codyx.org/snippet_lister-police-ecriture_333.aspx#1052
'    Posté par [ PCPT ] le 05/03/2007
<hr />




'  
A METTRE IMPéRATIVEMENT DANS UN MODULE


Option Explicit


Private Const 
LF_FACESIZE   
As Long 

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
'
Public Declare Function EnumFonts Lib "gdi32" Alias "EnumFontsA" (ByVal hdc As Long, ByVal lpsz As String, ByVal lpFontEnumProc As Long, ByVal lParam As Long) As
Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
'
Public Function EnumFontProc(ByVal lplf As Long, ByVal lptm
As Long, ByVal dwType As Long, ByVal lpData As Long) As
Long
    Dim LF          As LOGFONT
    Dim ZeroPos     As Long
    Dim FontName    As String
    
    Call CopyMemory(LF, ByVal lplf, LenB(LF))
    FontName = StrConv(LF.lfFaceName, vbUnicode)
    ZeroPos = InStr(1, FontName, Chr$(0))
    If ZeroPos > 0 Then Debug.Print Left$(FontName, ZeroPos - 1)
    EnumFontProc = True
End Function

'   EXEMPLE
D'UTILISATION
Private Sub Form_Load()
    Call EnumFonts(Me.hdc, vbNullString, AddressOf EnumFontProc, 0&)
End Sub











il suffit de remplacer


Debug.Print



par


taform.talist.additem



<hr size="2" width="100%" />
Prenez un instant pour répondre à [sujet-SONDAGE-POP3-POUR-CS_769706.aspx ce sondage] svp 
0