65,189
社区成员




HDC hdcTemp, hdcMemory;
hdcTemp = GetDC()->m_hDC;
hdcMemory = CreateCompatibleDC(hdcTemp);
//使内存DC存放位图
HBITMAP hBitMap = CreateCompatibleBitmap(hdcTemp, m_nWidth, m_nHeigth);
SelectObject(hdcMemory, hBitMap);
//设置Alpha值
m_blendFunc.SourceConstantAlpha = int(255*nTransparent/100);
//获取本窗口DC
HDC hdcScreen = ::GetDC(m_hWnd);
//将PNG图画入内存
Graphics graph(hdcMemory);
Point points[] ={
Point(0, 0),
Point(m_nWidth, 0),
Point(0, m_nHeigth)
};
graph.DrawImage(m_pImageTip, points, 3);
//绘制标题
DrawTitle(&graph);
SolidBrush* pBrush = new SolidBrush(Color::White);
graph.FillRectangle(pBrush, 20, 40, m_nWidth-40, m_nHeigth-80);
delete pBrush;
FontFamily fontFamily(L"宋体");
Font font(&fontFamily, 12, FontStyleBold, UnitPoint);
SolidBrush solidBrush(Color(255, 255, 255, 255));
PointF pointF(20, 15);
PWSTR pWideCharStr;
int nLenOfWideCharStr;
nLenOfWideCharStr = MultiByteToWideChar(CP_ACP, 0, LPCSTR(m_strTitle), -1, NULL, 0);
pWideCharStr = (PWSTR)HeapAlloc(GetProcessHeap(), 0, nLenOfWideCharStr*sizeof(wchar_t));
if(pWideCharStr!=NULL)
{
MultiByteToWideChar(CP_ACP, 0, LPCSTR(m_strTitle), m_strTitle.GetLength()+1, pWideCharStr, nLenOfWideCharStr);
pGraph->DrawString(pWideCharStr, nLenOfWideCharStr, &font, pointF, &solidBrush);
HeapFree(GetProcessHeap(), 0, pWideCharStr);
}