发信人: tsingxiao() 
整理人: girlrong(1999-11-10 07:47:42), 站内信件
 | 
 
 
 
                                          采编:LH
 
 
     如何改变控件的字体?
 
     由于控件是也是窗口,用户可以调用CWnd: : SetFont指定新字体。该函数用 一个
 Cfont指针,要保证在控
 件撤消之前不能撤消字体对象。下例将下压按钮的字体改为8点Arial字体:
 
     file://Declare font object in class declaration (.H file ).
     private :
     Cfont m_font ;
     // Set font in class implementation (.Cpp file ). Note m_wndButton  is a
     file://member variable added by ClassWizard.DDX routines hook the  member
     file://variable to a dialog button contrlo.
     BOOL CSampleDialog : : OnInitDialog ( )
     {
     …
     file://Create an 8-point Arial font
     m_font . CreateFont (MulDiv (8 , -pDC—> GetDeviceCaps (LOGPIXELSY ) ,
 72).
 
 0 , 0 , 0 , FW_NORMAL , 0 , 0, 0, ANSI_CHARSER, OUT_STROKE_PRECIS ,
 CLIP_STROKE _PRECIS , DRAFT _QUALITY
 VARIABLE_PITCH |FF_SWISS, _T ("Arial") );
     file://Set font for push button .
     m_wndButton . SetFont (&m _font );
     …
     }
 
 
  -- 我
   既不能达而兼善天下
                     只好穷而独善自身
   青山处处  斯民如土矣……
  ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.253.41]
  | 
 
 
 |