CMFCControlRendererInfo类是MS的一个私有类,msdn说不要用户直接调用,但我直接用了也没什么问题。渲染的效果还不错。记录它的7个参数及用法
我用它来给自绘的对话框贴图
比如这个类似ribbon主题颜色的标题栏的bmp图片
贴到去除了board的对话框标题栏位置如图
// first parameter is resource string ID of the image
// second parameter is the default transparent color
// third parameter is the image rectangle
// fourth parameter is the image corners
// fifth parameter is the image sides
// sixth parameter is the inner image rectangle
// seventh parameter indicates that a check for 32-bit images with alpha channel is not required
CMFCControlRendererInfo params(_T(""), CLR_DEFAULT, CRect(0, 0, 421, 32),
CRect(83, 58, 266, 1), CRect(0, 0, 0, 0), CRect(0, 0, 0, 0), TRUE);
<span style="white-space:pre"> CMFCControlRenderer m_Pat;</span>
params.m_uiBmpResID = IDB_PNG1;
m_Pat.Create(params);
CMFCControlRenderer* pRenderer = &m_Pat;
pRenderer->Draw(pDC, rcTitle);