1. 程式人生 > >MFC中怎樣字加下劃線

MFC中怎樣字加下劃線

CFont font; VERIFY(font.CreateFont( 36, // nHeight 

0, // nWidth 

0, // nEscapement 

0, // nOrientation 

FW_NORMAL, // nWeight

FALSE, // bItalic 

TRUE, // bUnderline下劃線標記,需要下劃線把這裡設定成TRUE

0, // cStrikeOut 

ANSI_CHARSET, // nCharSet 

OUT_DEFAULT_PRECIS, // nOutPrecision 

CLIP_DEFAULT_PRECIS, // nClipPrecision

DEFAULT_QUALITY, // nQuality 

DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily 

_T("Arial"))); // lpszFacename // Do something with the font just created... 

CClientDC dc(this);  

CFont* def_font = dc.SelectObject(&font); 

dc.TextOut(5, 5, _T("Hello,World!"), 5); 

dc.SelectObject(def_font); // Done with the font. Delete the font object. 

font.DeleteObject();