From ca5293331c17e2e06b0f06778a789b1dca78e3da Mon Sep 17 00:00:00 2001
From: Bunny <1319900154@qq.com>
Date: Mon, 30 Dec 2024 11:10:50 +0800
Subject: [PATCH] =?UTF-8?q?StackPanel2=E6=B7=B1=E5=85=A5=E7=90=86=E8=A7=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
WPF基础-2-StackPanel2/App.xaml | 9 +++++++
WPF基础-2-StackPanel2/App.xaml.cs | 12 ++++++++++
WPF基础-2-StackPanel2/AssemblyInfo.cs | 10 ++++++++
WPF基础-2-StackPanel2/MainWindow.xaml | 24 +++++++++++++++++++
WPF基础-2-StackPanel2/MainWindow.xaml.cs | 23 ++++++++++++++++++
.../WPF基础-2-StackPanel2.csproj | 12 ++++++++++
WPF基础.sln | 6 +++++
7 files changed, 96 insertions(+)
create mode 100644 WPF基础-2-StackPanel2/App.xaml
create mode 100644 WPF基础-2-StackPanel2/App.xaml.cs
create mode 100644 WPF基础-2-StackPanel2/AssemblyInfo.cs
create mode 100644 WPF基础-2-StackPanel2/MainWindow.xaml
create mode 100644 WPF基础-2-StackPanel2/MainWindow.xaml.cs
create mode 100644 WPF基础-2-StackPanel2/WPF基础-2-StackPanel2.csproj
diff --git a/WPF基础-2-StackPanel2/App.xaml b/WPF基础-2-StackPanel2/App.xaml
new file mode 100644
index 0000000..a59f44e
--- /dev/null
+++ b/WPF基础-2-StackPanel2/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/WPF基础-2-StackPanel2/App.xaml.cs b/WPF基础-2-StackPanel2/App.xaml.cs
new file mode 100644
index 0000000..12ddd86
--- /dev/null
+++ b/WPF基础-2-StackPanel2/App.xaml.cs
@@ -0,0 +1,12 @@
+using System.Configuration;
+using System.Data;
+using System.Windows;
+
+namespace WPF基础_2_StackPanel2;
+
+///
+/// Interaction logic for App.xaml
+///
+public partial class App : Application
+{
+}
\ No newline at end of file
diff --git a/WPF基础-2-StackPanel2/AssemblyInfo.cs b/WPF基础-2-StackPanel2/AssemblyInfo.cs
new file mode 100644
index 0000000..4a05c7d
--- /dev/null
+++ b/WPF基础-2-StackPanel2/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
\ No newline at end of file
diff --git a/WPF基础-2-StackPanel2/MainWindow.xaml b/WPF基础-2-StackPanel2/MainWindow.xaml
new file mode 100644
index 0000000..7478f05
--- /dev/null
+++ b/WPF基础-2-StackPanel2/MainWindow.xaml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+ 1. 每个按钮尺寸不能小于最小尺寸
+ 2. 每个按钮尺寸不能超过最大尺寸(除非执行错误操作,使最大尺寸比最小尺寸还小)
+ 3. 如果最小尺寸大于 <StackPanel> 宽度会被剪裁
+ 4. 水平尺寸,默认 HorizontalAlignment设置为Stretch 所以 <StackPanel> 将尝试放大按钮以沾满面板整个宽度
+
+
+
+
+
\ No newline at end of file
diff --git a/WPF基础-2-StackPanel2/MainWindow.xaml.cs b/WPF基础-2-StackPanel2/MainWindow.xaml.cs
new file mode 100644
index 0000000..cec2993
--- /dev/null
+++ b/WPF基础-2-StackPanel2/MainWindow.xaml.cs
@@ -0,0 +1,23 @@
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace WPF基础_2_StackPanel2;
+
+///
+/// Interaction logic for MainWindow.xaml
+///
+public partial class MainWindow : Window
+{
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/WPF基础-2-StackPanel2/WPF基础-2-StackPanel2.csproj b/WPF基础-2-StackPanel2/WPF基础-2-StackPanel2.csproj
new file mode 100644
index 0000000..7f92864
--- /dev/null
+++ b/WPF基础-2-StackPanel2/WPF基础-2-StackPanel2.csproj
@@ -0,0 +1,12 @@
+
+
+
+ WinExe
+ net8.0-windows
+ WPF基础_2_StackPanel2
+ enable
+ enable
+ true
+
+
+
diff --git a/WPF基础.sln b/WPF基础.sln
index c08a397..809ec6c 100644
--- a/WPF基础.sln
+++ b/WPF基础.sln
@@ -10,6 +10,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF基础-1-2-和xaml一起
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF基础-2-StackPanel", "WPF基础-2-StackPanel\WPF基础-2-StackPanel.csproj", "{0BF66DA6-EDC2-41D2-8D92-ABF4383B8DFB}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF基础-2-StackPanel2", "WPF基础-2-StackPanel2\WPF基础-2-StackPanel2.csproj", "{1D149BDE-58BF-4E85-8AC2-A689FE3E5E4D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -36,5 +38,9 @@ Global
{0BF66DA6-EDC2-41D2-8D92-ABF4383B8DFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0BF66DA6-EDC2-41D2-8D92-ABF4383B8DFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0BF66DA6-EDC2-41D2-8D92-ABF4383B8DFB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1D149BDE-58BF-4E85-8AC2-A689FE3E5E4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1D149BDE-58BF-4E85-8AC2-A689FE3E5E4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1D149BDE-58BF-4E85-8AC2-A689FE3E5E4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1D149BDE-58BF-4E85-8AC2-A689FE3E5E4D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal