我正在尝试重制一些旧项目以支持Aero Glass。虽然启用玻璃边框有点容易,但我遇到了一些主要问题。我使用了这段代码:
var
xVer: TOSVersionInfo;
hDWM: THandle;
DwmIsCompositionEnabled: function(pbEnabled: BOOL): HRESULT; stdcall;
DwmExtendFrameIntoClientArea: function(hWnd: HWND; const pxMarInset: PRect): HRESULT; stdcall;
bEnabled: BOOL;
xFrame: TRect;
// ...
xVer.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
GetVersionEx(xVer);
if xVer.dwMajorVersion >= 6 then
begin
hDWM := LoadLibrary('dwmapi.dll');
@DwmIsCompositionEnabled := GetProcAddress(hDWM, 'DwmIsCompositionEnabled');
@DwmExtendFrameIntoClientArea := GetProcAddress(hDWM, 'DwmExtendFrameIntoClientArea');
if (@DwmIsCompositionEnabled <> nil) and
(@DwmExtendFrameIntoClientArea <> nil) then
begin
DwmIsCompositionEnabled(@bEnabled);
if bEnabled then
begin
xRect := Rect(-1, -1, -1, -1);
DwmExtendFrameIntoClientArea(FrmMain.Handle, @xRect);
end;
end;
FreeLibrary(hDWM);
end;
现在我有一个漂亮的玻璃窗户。由于黑色现在是透明颜色(有点愚蠢的选择,为什么不能是粉色),任何clBlack的东西都变成了透明的。这意味着所有标签、编辑框、按钮文本……即使我在设计时将文本设置为其他颜色,DWM仍然会使它们成为透明的。
那么我的问题是 - 是否有可能解决这个问题?