Skip to content

Commit 4cc689d

Browse files
committed
新增 旧版磁贴模式(开关选项)
1 parent c2f9a6b commit 4cc689d

File tree

3 files changed

+76
-18
lines changed

3 files changed

+76
-18
lines changed

Form.Designer.cs

Lines changed: 32 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Form.cs

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private void Form_Load(object sender, EventArgs e) // 主窗口创建前
7070
// 获取主题色并设置图片框背景颜色
7171
SystemColor = "#" + Registry_SystemColor.Get_SystemColor();
7272
PictureBox_磁贴图片预览.BackColor = ColorTranslator.FromHtml(SystemColor);
73-
NewTileState = Registry_Other.Get_NewTileState(); // 获取是否开启 2004 新版磁贴样式
73+
NewTileState = Registry_Other.Get_NewTileState(); // 获取是否开启新版磁贴样式,或系统 2004 版本以上
7474
//Debug.Print(NewTileState.ToString());
7575

7676
// 磁贴预览标签背景透明
@@ -205,6 +205,14 @@ private void Read_AppConfig() // 读入程序配置文件
205205
{
206206
Button_自动检查更新.Text = "自动检查更新 [×]";
207207
}
208+
if (AppConfig.GetValue("LegacyTileMode", "false", AppConfig_Path) == "true")
209+
{
210+
Button_旧版磁贴模式.Text = "旧版磁贴模式 [√]";
211+
}
212+
else
213+
{
214+
Button_旧版磁贴模式.Text = "旧版磁贴模式 [×]";
215+
}
208216
}
209217

210218
private void Write_AppConfig() // 写出程序配置文件
@@ -217,6 +225,14 @@ private void Write_AppConfig() // 写出程序配置文件
217225
{
218226
AppConfig.SetValue("AutoCheckUpdate", "false", AppConfig_Path);
219227
}
228+
if (Button_旧版磁贴模式.Text == "旧版磁贴模式 [√]")
229+
{
230+
AppConfig.SetValue("LegacyTileMode", "true", AppConfig_Path);
231+
}
232+
else
233+
{
234+
AppConfig.SetValue("LegacyTileMode", "false", AppConfig_Path);
235+
}
220236
}
221237

222238
private void Form_DragEnter(object sender, DragEventArgs e) // 拖放
@@ -287,13 +303,13 @@ private void Read_Config() // 读入磁贴配置文件
287303
//Debug.Print(XML_VisualElements.ToString());
288304
if (XML_VisualElements.Attribute("BackgroundColor") != null) // 磁贴背景颜色
289305
{
290-
if (NewTileState == true) // 如果已经开启新版磁贴样式,则使用系统主题色
306+
if (Button_旧版磁贴模式.Text == "旧版磁贴模式 [√]" || NewTileState == false) // 如果没有开启新版磁贴样式/开启了旧版磁贴模式,则使用系统主题色
291307
{
292-
UserColor = SystemColor;
308+
UserColor = XML_VisualElements.Attribute("BackgroundColor").Value.ToString();
293309
}
294310
else
295311
{
296-
UserColor = XML_VisualElements.Attribute("BackgroundColor").Value.ToString();
312+
UserColor = SystemColor;
297313
}
298314
PictureBox_磁贴图片预览.BackColor = ColorTranslator.FromHtml(UserColor);
299315
}
@@ -631,7 +647,19 @@ private void Button_查看磁贴目录_Click(object sender, EventArgs e) // 查
631647
{
632648
_ = Process.Start(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Programs));
633649
}
634-
650+
651+
private void Button_旧版磁贴模式_Click(object sender, EventArgs e) // 旧版磁贴模式
652+
{
653+
if (Button_旧版磁贴模式.Text == "旧版磁贴模式 [√]")
654+
{
655+
Button_旧版磁贴模式.Text = "旧版磁贴模式 [×]";
656+
}
657+
else
658+
{
659+
Button_旧版磁贴模式.Text = "旧版磁贴模式 [√]";
660+
}
661+
}
662+
635663
private void Button_自动检查更新_Click(object sender, EventArgs e) // 自动检查更新
636664
{
637665
if (Button_自动检查更新.Text == "自动检查更新 [√]")
@@ -983,7 +1011,7 @@ private void PictureBox_磁贴图片预览_MouseDown(object sender, MouseEventAr
9831011
{
9841012
if (e.Button == MouseButtons.Left)
9851013
{
986-
if (NewTileState == false)
1014+
if (Button_旧版磁贴模式.Text == "旧版磁贴模式 [√]" || NewTileState == false) // 如果没有开启新版磁贴样式/开启了旧版磁贴模式,则允许取色
9871015
{
9881016
PictureBox_磁贴图片预览.Cursor = Cursors.Cross;
9891017
ScreenColorFlag = true;

磁贴美化小工具.csproj

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,20 @@
66
<PlatformTarget>x64</PlatformTarget>
77
<LangVersion>latest</LangVersion>
88
<UseWindowsForms>true</UseWindowsForms>
9-
<Version>4.0.9</Version>
9+
<Version>4.1.0</Version>
1010
<Company>XIU2</Company>
1111
<Copyright>Copyright © 2020 XIU2. All Rights Reserved.</Copyright>
1212
<ApplicationManifest>app.manifest</ApplicationManifest>
1313
<ApplicationIcon>Icon.ico</ApplicationIcon>
14+
<StartupObject>磁贴美化小工具.Program</StartupObject>
15+
</PropertyGroup>
16+
17+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net46|AnyCPU'">
18+
<OutputPath>D:\VS\Program\磁贴美化小工具\Release\</OutputPath>
19+
</PropertyGroup>
20+
21+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net46|AnyCPU'">
22+
<OutputPath>D:\VS\Program\磁贴美化小工具\Debug\</OutputPath>
1423
</PropertyGroup>
1524

1625
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">

0 commit comments

Comments
 (0)