Closed Tartarusome closed 18 hours ago
With 1.4, I use OverlappedPresenter.SetBorderAndTitleBar(false, false) and OverlappedPresenter.IsResizable = false (removes WS_THICKFRAME)
With 1.4, I use OverlappedPresenter.SetBorderAndTitleBar(false, false)在 1.4 中,我使用 OverlappedPresenter.SetBorderAndTitleBar(false, false) and OverlappedPresenter.IsResizable = false (removes WS_THICKFRAME)和 OverlappedPresenter.IsResizable = false(删除WS_THICKFRAME)
It works on 1.5.4 too, but how can I resize the window?Must I create a small triangle in the corner by myself?
It works on 1.5.4 too, but how can I resize the window?Must I create a small triangle in the corner by myself?
A way is to let it resizable and subclass it (SetWindowSubclass) to handle _WMNCCALCSIZE (mainly to increment the first RECT.top to reduce the size of top border) I tested on Windows 10 and I had to increment left and decrement right and bottom too (quick test with random values, should be calculated with APIs like AdjustWindowRect...) and set lParam to -1 in _WMNCACTIVATE, as MSDN says... and also SetWindowPos in Activated event for the first time the window is displayed) :
It works on 1.5.4 too, but how can I resize the window?Must I create a small triangle in the corner by myself?它也适用于 1.5.4,但是如何调整窗口大小?我必须自己在角落里创建一个小三角形吗?
A way is to let it resizable and subclass it (SetWindowSubclass) to handle _WMNCCALCSIZE (mainly to increment the first RECT.top to reduce the size of top border)一种方法是让它可调整大小并对其进行子类化 (SetWindowSubclass) 以处理WM_NCCALCSIZE(主要是增加第一个 RECT.top 以减小顶部边框的大小) I tested on Windows 10 and I had to increment left and decrement right and bottom too (quick test with random values, should be calculated with APIs like AdjustWindowRect...) and set lParam to -1 in _WMNCACTIVATE, as MSDN says... and also SetWindowPos in Activated event for the first time the window is displayed) :我在 Windows 10 上进行了测试,我也必须向左递增,向右递减右键和下键(使用随机值进行快速测试,应该使用 AdjustWindowRect 等 API 进行计算...)并在 WM_NCACTIVATE 年将 lParam 设置为 -1,正如 MSDN 所说......以及首次显示窗口时激活事件中的 SetWindowPos):
Hey bro. I just found a perfect way.It looks like the following:
This code would totally hide the title bar and the three caption buttons, but preserve a 32 or maybe 48 px rectangle overlay that is draggable and transparent.And you can use SetTitleBar(rootGrid); and set it to be interactive, then you can pretend the rootGrid is the content of a no-titlebar-window.
MS Learn Document
Here is the code.
public DockWindow() { this.InitializeComponent(); ExtendsContentIntoTitleBar = true; SetTitleBar(Part_TitleBar); var TestTitleBar = AppWindow.TitleBar; **TestTitleBar.PreferredHeightOption = TitleBarHeightOption.Collapsed;** }
It sounds like this has been solved.
I used win32 dll to set the height of titlebar to 0, which is equal to Windows.Style="None" if WPF. but the window would reserve a region with colored background, like the red region below.![image](https://github.com/microsoft/microsoft-ui-xaml/assets/142856268/4b3bdb11-006b-4c0c-8016-f46142ced5b0)
i write SetLayeredWindowAttributes(hWnd, 0, 0, LWA_ALPHA); but it doesnt work.
Here is my cs-behind `public sealed partial class DockWindow : Window { public DockWindow() { this.InitializeComponent(); //style=none IntPtr hWnd = WinRT.Interop.WindowNative.GetWindowHandle(this);
}`