1998.8.11

현재 폰트 크기 알기
------------------
        TEXTMETRIC tm;
        ::GetTextMetrics(hdc,&tm);        
        pxt=tm.tmAveCharWidth;  한 글자 넓이
        pyt = tm.tmHeight + tm.tmExternalLeading;  한글 높이


API 에서 폰트만들어 쓰기
-----------------------


        HFONT fnt;
        LOGFONT lf;
        
        lf.lfHeight = 40;
        lf.lfWidth = 20;      // 거의 높이의 반이다.
        lf.lfEscapement = 0;
        lf.lfOrientation = 0;
        lf.lfWeight = 0;
        lf.lfItalic = 0;
        lf.lfUnderline = 0;
        lf.lfStrikeOut = 0;
        lf.lfCharSet = 0;
        lf.lfOutPrecision = 0;
        lf.lfClipPrecision = 0;
        lf.lfQuality = 0;
        lf.lfPitchAndFamily = 0;
        strcpy( lf.lfFaceName,"smalls");
        fnt = CreateFontIndirect(&lf);

        fnt = (HFONT)SelectObject(hdc,fnt);        


프린트 하기
----------

        CPrintDialog* pDlg = new CPrintDialog(FALSE);
        DOCINFO di={ sizeof(DOCINFO),"DBFilm 프린트 중",NULL};
        if(pDlg->DoModal()==IDCANCEL)
        {
                delete pDlg;
                return;
        }

        HDC hdc=pDlg->GetPrinterDC();          //Printer DC를 얻는다.
        ::StartDoc(hdc,&di);      // 문서 작성 시작
        ::StartPage(hdc);        // 새페이지 마련
                :  
         hdc 그리기 작업을 한다.
                :
        ::RestoreDC(hdc,-1); //printer DC를 재저장한다.
        
        ::EndPage(hdc);         // 페이지 끝내기
        ::EndDoc(hdc);          // 문서 출력 끝

'KB > MFC/Win32' 카테고리의 다른 글

[db] ODBC 파일 등록하기  (0) 2004.03.19
dll 설명  (0) 2004.03.19
텍스트 크기 알기  (0) 2004.03.19
STUDY #6 : Window with Menu in API  (0) 2004.03.19
STUDY #4 : HDC  (0) 2004.03.19

+ Recent posts