avaloniaui Window 去除边框
如果您使用的是AvaloniaUI,您可以使用以下代码去除窗口边框:
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Avalonia.Platform;
using Avalonia.Styling;
public class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
// Remove window border
this.ExtendClientAreaToDecorationsHint = true;
this.CanResize = false;
// Set background to transparent
this.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
这将清除窗口边框并将窗口背景设置为透明。请注意,您需要将ExtendClientAreaToDecorationsHint属性设置为true,以确保内容不被遮盖
原文地址: http://www.cveoy.top/t/topic/dhOS 著作权归作者所有。请勿转载和采集!