diff --git a/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml b/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml index b1c27cf..b640ea9 100644 --- a/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml +++ b/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml @@ -27,10 +27,41 @@ - - - + + + + + + diff --git a/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml.cs b/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml.cs index 99f0049..31d7f67 100644 --- a/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml.cs +++ b/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml.cs @@ -25,8 +25,24 @@ namespace XplorePlane.Views Loaded += OnLoaded; } + /// + /// 当宿主为无边框窗口时,启用标题栏拖拽和关闭按钮 + /// + private void SetupBorderlessWindowSupport() + { + var hostWindow = Window.GetWindow(this); + if (hostWindow is OperatorToolboxWindow toolboxWindow) + { + TitleBar.MouseLeftButtonDown += toolboxWindow.TitleBar_MouseLeftButtonDown; + CloseBtn.Visibility = Visibility.Visible; + CloseBtn.Click += toolboxWindow.CloseButton_Click; + } + } + private void OnLoaded(object sender, RoutedEventArgs e) { + SetupBorderlessWindowSupport(); + ToolboxListBox.PreviewMouseLeftButtonDown += OnPreviewMouseDown; ToolboxListBox.PreviewMouseMove += OnPreviewMouseMove; _logger?.Debug("OperatorToolboxView 原生拖拽源已注册, DataContext={Type}", diff --git a/XplorePlane/Views/ImageProcessing/OperatorToolboxWindow.xaml b/XplorePlane/Views/ImageProcessing/OperatorToolboxWindow.xaml index 2e9bab9..519f94c 100644 --- a/XplorePlane/Views/ImageProcessing/OperatorToolboxWindow.xaml +++ b/XplorePlane/Views/ImageProcessing/OperatorToolboxWindow.xaml @@ -6,6 +6,14 @@ Width="260" Height="500" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" + WindowStyle="None" + AllowsTransparency="True" + Background="Transparent" ResizeMode="CanResizeWithGrip"> - + + + + + + diff --git a/XplorePlane/Views/ImageProcessing/OperatorToolboxWindow.xaml.cs b/XplorePlane/Views/ImageProcessing/OperatorToolboxWindow.xaml.cs index d3e2637..db12343 100644 --- a/XplorePlane/Views/ImageProcessing/OperatorToolboxWindow.xaml.cs +++ b/XplorePlane/Views/ImageProcessing/OperatorToolboxWindow.xaml.cs @@ -1,4 +1,5 @@ using System.Windows; +using System.Windows.Input; namespace XplorePlane.Views { @@ -8,5 +9,22 @@ namespace XplorePlane.Views { InitializeComponent(); } + + /// + /// 允许通过标题栏区域拖动无边框窗口 + /// + public void TitleBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + if (e.ClickCount == 1) + DragMove(); + } + + /// + /// 关闭窗口 + /// + public void CloseButton_Click(object sender, RoutedEventArgs e) + { + Close(); + } } } diff --git a/XplorePlane/Views/Main/MainWindow.xaml b/XplorePlane/Views/Main/MainWindow.xaml index ba86a2d..3defa1d 100644 --- a/XplorePlane/Views/Main/MainWindow.xaml +++ b/XplorePlane/Views/Main/MainWindow.xaml @@ -375,11 +375,6 @@ -