我想实现的东西,如Visual Studio安装确实有边界的窗口和阴影:边界的窗口与阴影
我尝试了各种选项,如CS_DROPSHADOW
和DWM API,但只要我应用了暗影消失的WS_THICKFRAME
风格。
这是我创建和居中的窗口代码:
RECT R = {0, 0, _clientWidth, _clientHeight};
AdjustWindowRect(&R, WS_OVERLAPPEDWINDOW, false);
_mainWnd = CreateWindow(L"D3DWndClassName", _mainWndCaption.c_str(), WS_OVERLAPPEDWINDOW, 100, 100, R.right, R.bottom, nullptr, nullptr, _appInst, nullptr);
if(!_mainWnd){
MessageBox(nullptr, L"CreateWindow FAILED", nullptr, 0);
PostQuitMessage(0);
}
RECT rc;
GetWindowRect(_mainWnd, &rc);
LONG lStyle = GetWindowLong(_mainWnd, GWL_STYLE);
lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU);
SetWindowLong(_mainWnd, GWL_STYLE, lStyle);
int xPos = (GetSystemMetrics(SM_CXSCREEN) - rc.right)/2;
int yPos = (GetSystemMetrics(SM_CYSCREEN) - rc.bottom)/2;
SetWindowPos(_mainWnd, 0, xPos, yPos, _clientWidth, _clientHeight, SWP_NOZORDER);
ShowWindow(_mainWnd, SW_SHOW);
UpdateWindow(_mainWnd);
没有类样式'CS_SHADOW'。你真的尝试过什么? – IInspectable
对不起,我的意思是CS_DROPSHADOW。它的效果与我作为例子提供的效果有所不同。 [比较](http://i.imgur.com/2JNOEgj.png) – wajsic
启动Spy ++工具并检查想要镜像的行为和属性。 – 2017-05-06 09:37:48