From a061384ba628a09bf4df91f50321ab22c03129aa Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期二, 18 三月 2025 20:58:36 +0800
Subject: [PATCH] Winform支持遮罩层;

---
 WPFProject/PanuonWindow.xaml |   40 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/WPFProject/PanuonWindow.xaml b/WPFProject/PanuonWindow.xaml
index f2d416d..e2f650f 100644
--- a/WPFProject/PanuonWindow.xaml
+++ b/WPFProject/PanuonWindow.xaml
@@ -12,15 +12,31 @@
             WindowState="Maximized"
             x:Name="window"
             BorderBrush="Transparent"
-            Loaded="window_Loaded"
+            pu:WindowXCaption.Buttons="All"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI"
             xmlns:hc="clr-namespace:HMI.Core;assembly=HMI.Core"
+            Closed="window_Closed"
+            Topmost="False"
             pu:WindowXCaption.Background="Transparent"
             pu:WindowXCaption.Height="80"
-            pu:WindowXCaption.Foreground="#FFF" >
+            IsOverlayerVisible="True"
+            pu:WindowXCaption.Foreground="#FFF">
     <Window.Resources>
         <hc:LangConverter x:Key="lc"/>
+        <Style x:Key="UserMenu" TargetType="Menu" BasedOn="{StaticResource {x:Static pu:StyleKeys.MenuStyle}}">
+            <Setter Property="Background" Value="{StaticResource PrimaryColor}"/>
+            <Setter Property="Foreground" Value="#FFF"/>
+            <Setter Property="pu:IconHelper.FontFamily" Value="{StaticResource iconfont}"/>
+            <Setter Property="pu:IconHelper.Margin" Value="0,0,10,0"/>
+            <Setter Property="BorderThickness" Value="0"/>
+            <Setter Property="Cursor" Value="Hand"/>
+            <Setter Property="pu:MenuHelper.SubmenuItemsForeground" Value="#3a3a3a"/>
+            <Setter Property="pu:MenuHelper.SubmenuItemsBackground" Value="White"/>
+            <Setter Property="pu:MenuHelper.TopLevelItemsHoverBackground" Value="{x:Null}"/>
+            <Setter Property="pu:MenuHelper.TopLevelDropDownPlacement" Value="BottomLeft"/>
+        </Style>
+
     </Window.Resources>
     <Window.Background>
         <ImageBrush Stretch="Uniform" AlignmentX="Left" AlignmentY="Top"  
@@ -49,6 +65,24 @@
 
     <pu:WindowXCaption.ExtendControl>
         <StackPanel Orientation="Horizontal">
+            <Menu Margin="0" Padding="0" VerticalAlignment="Top"
+                  VerticalContentAlignment="Center" Style="{StaticResource UserMenu}"
+                  
+                  Background="Transparent">
+                <MenuItem x:Name="userMenu" FontSize="16">
+                    <MenuItem 
+                        Icon="&#xe61d;"
+                        Cursor="Hand" FontSize="14" Header="閫�鍑虹櫥褰�"
+                              x:Name="MiLogout"
+                              Click="MenuItem_Click"/>
+                    <MenuItem Cursor="Hand" FontSize="14" 
+                        Icon="&#xe867;"
+                              Header="閲嶆柊鍚姩"
+                              x:Name="MiRestart"
+                              Click="MenuItem_Click"/>
+                </MenuItem>
+            </Menu>
+
             <Button x:Name="BtnSwitchTheme"
                 FontSize="18"
                 FontFamily="/HMI.UI;component/Resources/Font/#iconfont"
@@ -68,7 +102,7 @@
                         </Style.Triggers>
                     </Style>
                 </Button.Style>
-                
+
             </Button>
         </StackPanel>
     </pu:WindowXCaption.ExtendControl>

--
Gitblit v1.9.1