void CDrawTextDemoView::OnPaint()
{
 CPaintDC dc(this); // device context for painting

 CRect Rect(10,10,200,50);
 dc.FillSolidRect(&Rect, RGB(192,192,192));
//테투리없는 사각형을 그리고 RGB값으로 내부를 칠함.

 CFont Font;
 LOGFONT lf;
 ::ZeroMemory(&lf, sizeof(lf));

 lf.lfHeight = 20;
 wsprintf(lf.lfFaceName , _T("%s"), _T("Arial"));
 lf.lfItalic = true;
 lf.lfUnderline = true;
 Font.CreateFontIndirect(&lf);
 CFont* pOldFont = dc.SelectObject(&Font);
 
 //폰트 색깔 바꾸고 실제출력
 dc.SetTextColor(RGB(255,0,0));

 dc.DrawText(_T("Text Button"), &Rect, DT_CENTER | DT_SINGLELINE | DT_VCENTER );

 dc.TextOut(50,100,_T("\t이것은 실습을 위한 \n문자열입니다."));

 int nTabStop = 100;

 dc.TabbedTextOut(50,150, _T("\t이것은 실습을 위한 \n문자열입니다."),1, &nTabStop,20);

 dc.DrawText( _T("\t이것은 실습을 위한 \n문자열입니다."), CRect(50,220,300,200), DT_SINGLELINE | DT_CENTER | DT_VCENTER  );
 
 dc.SelectObject(pOldFont);
}

'Windows > MFC' 카테고리의 다른 글

고급 이미지 출력 함수 ( TransparentBlt() , AlphaBlend() )  (0) 2011.11.14
비트맵과 이미지 처리  (0) 2011.11.14
직접 버튼 그리기  (0) 2011.11.13
글꼴과 문자열 다루기  (0) 2011.11.13
키보드 입력  (0) 2011.11.12

+ Recent posts