CreateFont/CreateFontIndirect 고정폭 폰트, 폰트색상 이상한 문제
C언어,ARM / 2020. 1. 11. 22:29
CreateFont/CreateFontIndirect 함수로 폰트 생성시,
lfWidth=size;
lfPitchAndFamily=FIXED_PITCH;//고정폭
lfQuality=NONANTIALIASED_QUALITY;//폰트색이 부분 부분 칼라로 나오는 문제
class CFont2 { public: HFONT m_hFont,m_hFont_old; HDC m_hdc; LOGFONT m_logfont; CFont2(HDC hdc,TCHAR *name,int size) { m_hFont=0; m_hFont_old=0; m_hdc=hdc; memset(&m_logfont,0,sizeof(m_logfont)); //m_logfont.lfHeight== -MulDiv(size, GetDeviceCaps(hdc,LOGPIXELSY),72); m_logfont.lfWidth=size; //m_logfont.lfEscapement; //m_logfont.lfOrientation; //m_logfont.lfWeight=FW_BOLD; //m_logfont.lfItalic; //m_logfont.lfUnderline; //m_logfont.lfStrikeOut; m_logfont.lfCharSet=OEM_CHARSET; //m_logfont.lfOutPrecision; //m_logfont.lfClipPrecision=OUT_DEFAULT_PRECIS; m_logfont.lfQuality=NONANTIALIASED_QUALITY;//폰트색이 부분 부분 칼라로 나오는 문제 m_logfont.lfPitchAndFamily=FIXED_PITCH;//고정폭 strcpy(m_logfont.lfFaceName,name); CreateSelect(name,size); } HFONT CreateSelect(TCHAR *name,int size)//ret=m_hFont_old { Delete(); m_logfont.lfWidth=size; strcpy(m_logfont.lfFaceName,name); m_hFont=CreateFontIndirect(&m_logfont); if(m_hFont) { m_hFont_old=(HFONT)SelectObject(m_hdc,m_hFont); } return m_hFont_old; } void Delete() { if(m_hFont_old) { SelectObject(m_hdc,m_hFont_old); m_hFont_old=0; } if(m_hFont) { DeleteObject(m_hFont); m_hFont=0; } } ~CFont2() { Delete(); } };
'C언어,ARM' 카테고리의 다른 글
I2C 통신속도 계산 (0) | 2020.01.11 |
---|---|
error C2085: 'xxx' : not in formal parameter list (0) | 2020.01.11 |
include/stdint.h:126:22: error: duplicate 'unsigned' (0) | 2020.01.11 |
Push pull , Open drain (0) | 2020.01.02 |
WIN32, MFC - 버튼 눌린 이벤트 처리 (0) | 2019.12.30 |