0
我想要一个无边框对话框,但却有对话框阴影。我遇到了这种解决方案Borderless Window Using Areo Snap, Shadow, Minimize Animation, and Shake,它通过使对话框的边距为1 px并将客户区扩展到该解决方案来使用解决方法。通过MFC对话框中的对话框边距绘图
MARGINS borderless = { 1, 1, 1, 1 };
DwmExtendFrameInfoClientArea(this->GetSafeHwnd(), &borderless);
帖子中提到的客户区字面上正在扩展和透明拉丝再次使得1px的每个可见对话框的边缘。
现在,这到底发生了什么,当我试图画一个实心矩形到整个对话:
// getting the client area
CRect clientRect;
GetClientRect(&clientRect);
// expanding it to the new margins
clientRect.left -= 1;
clientRect.top -= 1;
clientRect.right += 2;
clientRect.bottom += 2;
// set the Device Context to draw non transparent and with a black background
pDC->SetBkMode(OPAQUE);
pDC->SetBkColor(RGB(0, 0, 0));
// finally draw a rectangle to it
CBrush brush_back_ground(RGB(0, 0, 0));
pDC->FillRect(clientRect, &brush_back_ground);
但对话仍与它的利润率得出:
如何将它有可能绘制一些东西在边缘?稍后我将使用图片作为对话框背景,这些背景也应该绘制在边缘上。
不能使用传统24 bpp的GDI函数在玻璃面积绘制,输出将保持透明。你需要32bpp渲染,alpha通道必须包含,GDI +可以做到这一点。 – 2014-10-03 12:21:09