From 58814389fac0ecf0f12e2509f3bf522082ed9f0f Mon Sep 17 00:00:00 2001
From: chr <chrry550@163.com>
Date: 星期二, 05 三月 2024 12:01:45 +0800
Subject: [PATCH] 优化输出目录结构;
---
Utils/CanvasHelper.cs | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/Utils/CanvasHelper.cs b/Utils/CanvasHelper.cs
index 63bf333..246f2a4 100644
--- a/Utils/CanvasHelper.cs
+++ b/Utils/CanvasHelper.cs
@@ -2,29 +2,31 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
+using WPFProject.Controls;
namespace WPFProject.Utils
{
public class CanvasHelper
{
- public static void SetTopZIndex(object element, DependencyObject parent, Type targetClass)
+ public static void SetTopZIndex(InnerWindow element, DependencyObject parent, Type targetClass)
{
+ int max = 0;
+ int zindex = element.Zindex;
+
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
{
- UIElement child = VisualTreeHelper.GetChild(parent, i) as UIElement;
+ InnerWindow child = VisualTreeHelper.GetChild(parent, i) as InnerWindow;
if (child != null && targetClass == child.GetType())
{
- if (element == child)
+ if (element != child && child.Zindex >= zindex)
{
- Canvas.SetZIndex(child, 1);
+ child.Zindex = child.Zindex-1;
}
- else
- {
- Canvas.SetZIndex(child, 0);
- }
+
}
-
+ max++;
}
+ element.Zindex = max;
}
}
}
--
Gitblit v1.9.1