VC++ 6.0
2012.12.27 10:08
객체(텍스트관련)의 폰트를 변경하는 방법
다물칸 주소복사
조회 수 3185 추천 수 0 댓글 0
구분 | 팁&트릭 |
---|
객체라함은 라벨, 텍스트박스, 리스트박스, 콤보박스 등 문자열이 사용되는 객체를 말합니다.
폰트변경은 HFont 구조체를 사용하여 SendMessage로 변경하는 방법입니다.
HFont 구조는 다음과 같습니다.
HFONT CreateFont( int nHeight, // logical height of font int nWidth, // logical average character width int nEscapement, // angle of escapement int nOrientation, // base-line orientation angle int fnWeight, // font weight DWORD fdwItalic, // italic attribute flag DWORD fdwUnderline, // underline attribute flag DWORD fdwStrikeOut, // strikeout attribute flag DWORD fdwCharSet, // character set identifier DWORD fdwOutputPrecision, // output precision DWORD fdwClipPrecision, // clipping precision DWORD fdwQuality, // output quality DWORD fdwPitchAndFamily, // pitch and family LPCTSTR lpszFace // pointer to typeface name string );
사용방법은 다음과 같습니다.
HFONT hNewFont; hNewFont=CreateFont( 12,0,0,0,0,0,0,0,HANGEUL_CHARSET,3,2,1, VARIABLE_PITCH | FF_MODERN,"돋음"); m_hList.SendMessage( WM_SETFONT, (WPARAM)hNewFont, (LPARAM)TRUE);