Slt,

j'essai de faire comme sur le tut :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
   CWnd *pWnd = GetDlgItem(IDC_STATIC1);
   CFont* pFont = pWnd->GetFont();
   if(pFont!=NULL)
   {
      LOGFONT lf;
      pFont->GetLogFont(&lf);
      lf.lfWeight=FW_BOLD;//mettre l'attribut en gras par exemple.
      // CFont m_font;  // objet local à la classe parent fenetre CDialog,CFormView
 
      m_font.DeleteObject();  // destruction GDI de l'ancien objet eventuellement
      m_font.CreateFontIndirect(&lf); // creation de la fonte d'apres la LOGFONT
    }
    pWnd->SetFont(&m_font);  // affectation de la nouvelle fonte.
mais jcapte pas pourquoi, ca me change la taille de la police

meme si je ne fais aucune modif à lf, (en supprimant la ligne : lf.lfWeight=FW_BOLD;)

quand je quickwatch LF, j'obtiens :
- lf {lfHeight=-11 lfWidth=0 lfEscapement=0 ...} tagLOGFONTA
lfHeight -11 long
lfWidth 0 long
lfEscapement 0 long
lfOrientation 0 long
lfWeight 400 long
lfItalic 0 unsigned char
lfUnderline 0 unsigned char
lfStrikeOut 0 unsigned char
lfCharSet 0 unsigned char
lfOutPrecision 0 unsigned char
lfClipPrecision 0 unsigned char
lfQuality 0 unsigned char
lfPitchAndFamily 0 unsigned char
+ lfFaceName 0x0012e9a8 "MS Shell Dlg 2" char [32]
A votre avis ?