Windows/MFC

폰트 선택 CFontDialog

aucd29 2013. 10. 2. 17:52
폰트 선택 CFontDialog
[code]
CFontDialog(LPLOGFONT lplfInitial = NULL, DWORD dwFlags = CF_EFFECTS | CF_SCREENFONTS,
            CDC* pdcPrinter = NULL,CWnd* pParentWnd = NULL);

CFontDialog의 멤버함수
void GetCurrentFont(LPLOGFONT lplf);    - 현재 사용하는 폰트의 구조체를 얻는다.
CStrig GetFaceName() const;                - 사용하는 푠트의 페이스명(이름)을 얻는다.
CString GetStyleName(0 const;            - 사용한는 폰트의 스타일 명
int GetSize() const;                    - 폰트의 크기를 포인트 단위로 반환
COLORREF GetColor() const;                - 사용하는 폰트의 색상을 반환
int GetWeight() const;                    - 선택된 폰트의 두께를 반환
BOOL IsStrikeOut() const;                - 폰트가 ‘strike out' 속성을 가지고 있으면 TRUE값을 반환
BOOL IsUnderline() const;                'underline'
BOOL IsBold() const;                    'bold'
BOOL IsItalic() const;                    'italic'
[/code]


[code]
void CCommonDlgView::OnFont()
{
    CFontDialog dlg(&lf);
    color = dlg.GetColor();
    if(dlg.DoModal() == IDOK)
    {
        CString str;

        //선택된 글꼴의 정보를 얻는다.
        str.Format("Face Name : %s, FontSize :%d",dlg.GetFaceName(), dlg.GetSize()/10);
        MessageBox(str,"글꼴정보");
    }
}
[/code]