mfc---添加背景图

添加背景图:

CDC m_dcMem

CBitmap m_bmpMem

 

CDC * pDC = GetDC();

m_dc.CreateComparableDC(pDC);

m_bmpMem.LoadBitmap(ID_IMAGE);

RealeaseDC(pDC);

 

CDC * pDC = GetDC();

CRect rc = GetClientRect();

pDC.BitBlt(0,0,rc.Width(),rc.Height(),&m_dcMem,0,0,SRCC0PY);

 

初始化弹出对话框路径:

Dlg.m_ofn.lpstrInitialDir = 初始化路径

 

填充dc的背景色:dc.FillSolidRect

设置dc的字体颜色:dc.SetTextColor

 

设置字体:CFont font.CreateFont()

oldFont = m_dcComplex.SelectObject(&Font);

m_dcComplex.TextOut(0,0,strInfo);

m_dcComplex.SelectObject(oldFont);

 

得到文本大小:CSize sz = dc.GetOutputTextExtent(strInfo);

 

使用颜色对话框:CColorDialog dlg;

if(dlg.DoModal() == IDOK)

{

COLORREF color = dlg.GetColor();

}

posted on 2014-03-11 22:57  DaMengZhang  阅读(185)  评论(0编辑  收藏  举报