close
以下是自製Source Code參考

CString WidthString,HeightString;
m_Width.GetWindowText(WidthString);
m_Height.GetWindowText(HeightString);
int Width,Height;

Width = atoi((const char*)WidthString);
Height = atoi((const char*)HeightString);

int Pixel=Height;
HDC hSrc;     //screen DC
HDC hMemDC;
 
HBITMAP hBitmap,hOldBitmap; 
HFONT hFont,hOldFont;

hSrc = ::GetDC(this->m_hWnd); //Get視窗的Client Area Dc
hMemDC  = CreateCompatibleDC(hSrc);
hBitmap = CreateCompatibleBitmap(hSrc ,Pixel,Pixel);
hOldBitmap = (HBITMAP)SelectObject(hMemDC,hBitmap);

//hFont = CreateFont(-(int)(fabs(250*GetDeviceCaps(hSrc,LOGPIXELSY)/72)/10.0+0.5),0,0,0,500,FALSE,FALSE,FALSE,0,0,0,0,0,"標楷體");
hFont = CreateFont(Pixel,0,0,0,500,FALSE,FALSE,FALSE,0,0,0,0,0,"標楷體");
hOldFont=(HFONT)SelectObject(hMemDC,hFont);
CString WordString;
m_WordEditString.GetWindowText(WordString);
TextOut(hMemDC,0,0,WordString,2);

BitBlt(hSrc,0,0,                // destination (x,y)           
           Pixel,Pixel, // width, height
           hMemDC,0,0,             // source (x,y)
           SRCCOPY);

SelectObject(hSrc, hOldFont);
DeleteObject(hFont);
SelectObject(hMemDC, hOldBitmap);
DeleteObject(hBitmap);
::ReleaseDC(NULL,hSrc);
DeleteDC(hMemDC);


參考文章
http://itzone.hk/article/article.php?aid=200406211225299402

http://stweb.cgu.edu.tw/~m9221001/VC/CreateFont.mht
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 pipii 的頭像
    pipii

    Live Pipii

    pipii 發表在 痞客邦 留言(0) 人氣()