From 58ca99a7066e77c2924d4c0ef4a7acae5d8abb47 Mon Sep 17 00:00:00 2001 From: Bunny <1319900154@qq.com> Date: Thu, 2 Jan 2025 20:41:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20WPF=E6=8E=A7=E4=BB=B6-1-=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 38 ++++++++++++++++++++ WPF控件-1-设置颜色/App.xaml | 9 +++++ WPF控件-1-设置颜色/App.xaml.cs | 12 +++++++ WPF控件-1-设置颜色/AssemblyInfo.cs | 10 ++++++ WPF控件-1-设置颜色/MainWindow.xaml | 36 +++++++++++++++++++ WPF控件-1-设置颜色/MainWindow.xaml.cs | 24 +++++++++++++ WPF控件-1-设置颜色/WPF控件-1-设置颜色.csproj | 12 +++++++ WPF控件.sln | 16 +++++++++ 8 files changed, 157 insertions(+) create mode 100644 .gitignore create mode 100644 WPF控件-1-设置颜色/App.xaml create mode 100644 WPF控件-1-设置颜色/App.xaml.cs create mode 100644 WPF控件-1-设置颜色/AssemblyInfo.cs create mode 100644 WPF控件-1-设置颜色/MainWindow.xaml create mode 100644 WPF控件-1-设置颜色/MainWindow.xaml.cs create mode 100644 WPF控件-1-设置颜色/WPF控件-1-设置颜色.csproj create mode 100644 WPF控件.sln diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ffd1659 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ +logs/ +application-prod.yml +[b|B]in +[o|O]bj + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/WPF控件-1-设置颜色/App.xaml b/WPF控件-1-设置颜色/App.xaml new file mode 100644 index 0000000..289583f --- /dev/null +++ b/WPF控件-1-设置颜色/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/WPF控件-1-设置颜色/App.xaml.cs b/WPF控件-1-设置颜色/App.xaml.cs new file mode 100644 index 0000000..91a2679 --- /dev/null +++ b/WPF控件-1-设置颜色/App.xaml.cs @@ -0,0 +1,12 @@ +using System.Configuration; +using System.Data; +using System.Windows; + +namespace WPF控件; + +/// +/// Interaction logic for App.xaml +/// +public partial class App : Application +{ +} \ No newline at end of file diff --git a/WPF控件-1-设置颜色/AssemblyInfo.cs b/WPF控件-1-设置颜色/AssemblyInfo.cs new file mode 100644 index 0000000..4a05c7d --- /dev/null +++ b/WPF控件-1-设置颜色/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控件-1-设置颜色/MainWindow.xaml b/WPF控件-1-设置颜色/MainWindow.xaml new file mode 100644 index 0000000..62bfba7 --- /dev/null +++ b/WPF控件-1-设置颜色/MainWindow.xaml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + 下划线。。。。 + + + + TextOptions.TextFormattingMode="Display"用于显示尺寸小显示模糊的问题 + + + + + + + \ No newline at end of file diff --git a/WPF控件-1-设置颜色/MainWindow.xaml.cs b/WPF控件-1-设置颜色/MainWindow.xaml.cs new file mode 100644 index 0000000..cad3338 --- /dev/null +++ b/WPF控件-1-设置颜色/MainWindow.xaml.cs @@ -0,0 +1,24 @@ +using System.Windows; +using System.Windows.Media; + +namespace WPF控件; + +/// +/// Interaction logic for MainWindow.xaml +/// +public partial class MainWindow : Window +{ + public MainWindow() + { + InitializeComponent(); + Cmd.Background = new SolidColorBrush(SystemColors.ControlColor); + + // 简写形式 + Cmd.Background = SystemColors.ControlBrush; + + // 设置字体颜色 + Cmd.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0)); + + foreach (var fontFamily in Fonts.SystemFontFamilies) ListBox.Items.Add(fontFamily.Source); + } +} \ No newline at end of file diff --git a/WPF控件-1-设置颜色/WPF控件-1-设置颜色.csproj b/WPF控件-1-设置颜色/WPF控件-1-设置颜色.csproj new file mode 100644 index 0000000..3e91f20 --- /dev/null +++ b/WPF控件-1-设置颜色/WPF控件-1-设置颜色.csproj @@ -0,0 +1,12 @@ + + + + WinExe + net8.0-windows + enable + enable + true + WPF控件 + + + diff --git a/WPF控件.sln b/WPF控件.sln new file mode 100644 index 0000000..1582332 --- /dev/null +++ b/WPF控件.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-1-设置颜色", "WPF控件-1-设置颜色\WPF控件-1-设置颜色.csproj", "{5D1AD019-4A90-48E2-815A-35EE2B002BD2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5D1AD019-4A90-48E2-815A-35EE2B002BD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5D1AD019-4A90-48E2-815A-35EE2B002BD2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5D1AD019-4A90-48E2-815A-35EE2B002BD2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5D1AD019-4A90-48E2-815A-35EE2B002BD2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal