【发布时间】:2022-10-19 17:18:12
【问题描述】:
我想在 .NET MAUI for Windows 中实现自定义标题栏。为此,我需要删除默认标题栏,但 SetWindowLong 没有按预期工作,特别是标题栏似乎被水平切成两半。
我尝试使用的代码如下:
WindowHandler.Mapper.AppendToMapping("CustomFunc", (handler, view) =>
{
var nativeWindow = handler.PlatformView;
IntPtr hWnd = WinRT.Interop.WindowNative.GetWindowHandle(nativeWindow);
SetWindowLong(hWnd, GWL_STYLE, WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP);
nativeWindow.Activate();
});
有谁知道如何解决这个问题? 是否可以避免使用 SetWindowLong 而使用 MAUI 功能?
【问题讨论】:
-
您能否添加标题栏的屏幕截图,因为它似乎被“切成两半”?这将有助于澄清,谢谢。
-
我很惊讶
SetWindowLong完全有效,考虑到“现代”应用程序表面上不通过USER32。