From 375b488be2666cd56e70728624f4eadaefee0440 Mon Sep 17 00:00:00 2001
From: chenghaoran <chenghaoran@ipilotwhale.com>
Date: 星期二, 12 三月 2024 17:36:49 +0800
Subject: [PATCH] 优化项目结构;
---
WPFProject/Controls/InnerWindow.xaml.cs | 92 +++++++++++++++++++++++-----------------------
1 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/Controls/InnerWindow.xaml.cs b/WPFProject/Controls/InnerWindow.xaml.cs
similarity index 99%
rename from Controls/InnerWindow.xaml.cs
rename to WPFProject/Controls/InnerWindow.xaml.cs
index 6c89b76..b665787 100644
--- a/Controls/InnerWindow.xaml.cs
+++ b/WPFProject/Controls/InnerWindow.xaml.cs
@@ -20,7 +20,7 @@
/// InnerWindow.xaml 鐨勪氦浜掗�昏緫
/// </summary>
public partial class InnerWindow : UserControl, INotifyPropertyChanged
- {
+ {
#region INotifyPropertyChanged
public virtual event PropertyChangedEventHandler PropertyChanged;
@@ -36,45 +36,45 @@
{
RaisePropertyChanged(propertyName);
}
- }
+ }
#endregion
-
+
#region 灞炴��
-
+
#region Common
public DragType DragType { get; set; } = DragType.Canvas;
public CanvasPosition canvasPosition;
private Canvas canvas;
public WindowState WindowState { get; set; } = WindowState.Normal;
- public AdornerDecorator ResizeAdornerDecorator { get => VisualTreeHelper.GetChild(this, 0) as AdornerDecorator; }
-
+ public AdornerDecorator ResizeAdornerDecorator { get => VisualTreeHelper.GetChild(this, 0) as AdornerDecorator; }
+
private string _Title;
public string Title
{
get { return _Title; }
set => RaiseAndSetIfChanged(ref _Title, value);
- }
-
+ }
+
public int Zindex
{
- get
+ get
{
return Canvas.GetZIndex(this);
}
set
{
Canvas.SetZIndex(this, value);
- }
- }
- #endregion
-
+ }
+ }
+ #endregion
+
#region 浜嬩欢
public event EventHandler MinEvent;
public event EventHandler MaxEvent;
public event EventHandler CloseEvent;
- public event EventHandler ZIndexEvent;
- #endregion
-
+ public event EventHandler ZIndexEvent;
+ #endregion
+
#region DependencyProperty
public Brush HeaderBackground
{
@@ -94,11 +94,11 @@
public static readonly DependencyProperty HeaderFontColorProperty =
DependencyProperty.Register("HeaderFontColor", typeof(Brush), typeof(ProgramList),
- new PropertyMetadata(new SolidColorBrush(Color.FromRgb(255, 255, 225))));
- #endregion
-
- #endregion
-
+ new PropertyMetadata(new SolidColorBrush(Color.FromRgb(255, 255, 225))));
+ #endregion
+
+ #endregion
+
public InnerWindow() : this(null)
{
@@ -131,8 +131,8 @@
};
}
Loaded -= InnerWindow_Loaded;
- }
-
+ }
+
#region 鎷栨嫿绉诲姩鐩稿叧
private void DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
@@ -179,7 +179,7 @@
{
canvasPosition.Top = Canvas.GetTop(this);
canvasPosition.Left = Canvas.GetLeft(this);
- }
+ }
#endregion
/// <summary>
@@ -205,22 +205,22 @@
Canvas.SetLeft(this, canvasPosition == null ? 0 : canvasPosition.Left);
Canvas.SetTop(this, canvasPosition == null ? 0 : canvasPosition.Top);
canvas.SizeChanged += Canvas_SizeChanged;
- }
-
- private void Canvas_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- Size newSize = e.NewSize;
- Size previousSize = e.PreviousSize;
-
- double xRate = newSize.Width / previousSize.Width;
- double yRate = newSize.Height / previousSize.Height;
-
- Canvas.SetLeft(this, Canvas.GetLeft(this) * xRate);
- Canvas.SetTop(this, Canvas.GetTop(this) * yRate);
- this.Width = this.Width * xRate;
- this.Height = this.Height * yRate;
- }
-
+ }
+
+ private void Canvas_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ Size newSize = e.NewSize;
+ Size previousSize = e.PreviousSize;
+
+ double xRate = newSize.Width / previousSize.Width;
+ double yRate = newSize.Height / previousSize.Height;
+
+ Canvas.SetLeft(this, Canvas.GetLeft(this) * xRate);
+ Canvas.SetTop(this, Canvas.GetTop(this) * yRate);
+ this.Width = this.Width * xRate;
+ this.Height = this.Height * yRate;
+ }
+
private void Min_Click(object sender, RoutedEventArgs e)
{
MinEvent?.Invoke(this, null);
@@ -244,12 +244,12 @@
private void Grid_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
this.Focus();
- }
-
- private void UserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
-
- }
+ }
+
+ private void UserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+
+ }
}
public enum DragType
--
Gitblit v1.9.1