删除艺术字

This commit is contained in:
zsyg
2025-07-07 17:52:13 +08:00
committed by GitHub
parent e47f905a8c
commit 6d2711da08
15 changed files with 137 additions and 215 deletions

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View File

@@ -1,131 +1,137 @@
// _ _ using System;
//| | _____ _ __| |_ __ _ _ __ _ __ ____ using System.Drawing;
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ / using System.Windows.Forms;
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___| namespace AppStore
// |_| |_| {
using System; public class DownloadItem : UserControl
using System.Drawing; {
using System.Windows.Forms; private Label nameLabel;
private ProgressBar progressBar;
namespace AppStore private Label statusLabel;
{ private Button cancelBtn;
public class DownloadItem : UserControl
{ public string FileName { get; set; } = string.Empty;
private Label nameLabel; public int Progress { get; set; }
private ProgressBar progressBar; public string Status { get; set; } = string.Empty;
private Label statusLabel;
private Button cancelBtn; public DownloadItem()
{
public string FileName { get; set; } = string.Empty; nameLabel = new Label();
public int Progress { get; set; } progressBar = new ProgressBar();
public string Status { get; set; } = string.Empty; statusLabel = new Label();
cancelBtn = new Button();
public DownloadItem()
{ InitializeComponent();
nameLabel = new Label();
progressBar = new ProgressBar(); // 监听主题变化
statusLabel = new Label(); ThemeManager.ThemeChanged += (theme) => {
cancelBtn = new Button(); this.Invoke((MethodInvoker)delegate {
ApplyTheme();
InitializeComponent(); });
};
// 监听主题变化 }
ThemeManager.ThemeChanged += (theme) => {
this.Invoke((MethodInvoker)delegate { private void ApplyTheme()
ApplyTheme(); {
}); this.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
}; ? Color.White
} : Color.Black;
this.ForeColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
private void ApplyTheme() ? Color.Black
{ : Color.White;
this.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
? Color.White cancelBtn.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
: Color.Black; ? SystemColors.Control
this.ForeColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light : Color.FromArgb(70, 70, 70);
? Color.Black cancelBtn.ForeColor = ThemeManager.TextColor;
: Color.White; }
cancelBtn.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light private void InitializeComponent()
? SystemColors.Control {
: Color.FromArgb(70, 70, 70); this.Size = new Size(400, 60);
cancelBtn.ForeColor = ThemeManager.TextColor; this.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
} ? Color.White
: Color.Black;
private void InitializeComponent() this.BorderStyle = BorderStyle.None; // 禁用默认边框
{ this.ForeColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
this.Size = new Size(400, 60); ? Color.Black
this.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light : Color.White;
? Color.White this.Paint += DownloadItem_Paint; // 添加自定义绘制
: Color.Black;
this.BorderStyle = BorderStyle.FixedSingle; // 文件名标签
this.ForeColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light nameLabel = new Label();
? Color.Black nameLabel.AutoSize = true;
: Color.White; nameLabel.Location = new Point(10, 10);
nameLabel.Font = new Font("Microsoft YaHei", 9, FontStyle.Bold);
// 文件名标签 this.Controls.Add(nameLabel);
nameLabel = new Label();
nameLabel.AutoSize = true; // 进度条
nameLabel.Location = new Point(10, 10); progressBar = new ProgressBar();
nameLabel.Font = new Font("Microsoft YaHei", 9, FontStyle.Bold); progressBar.Size = new Size(200, 20);
this.Controls.Add(nameLabel); progressBar.Location = new Point(10, 30);
this.Controls.Add(progressBar);
// 进度条
progressBar = new ProgressBar(); // 状态标签
progressBar.Size = new Size(200, 20); statusLabel = new Label();
progressBar.Location = new Point(10, 30); statusLabel.AutoSize = true;
this.Controls.Add(progressBar); statusLabel.Location = new Point(220, 30);
statusLabel.Font = new Font("Microsoft YaHei", 8);
// 状态标签 this.Controls.Add(statusLabel);
statusLabel = new Label();
statusLabel.AutoSize = true; // 取消按钮
statusLabel.Location = new Point(220, 30); cancelBtn = new Button();
statusLabel.Font = new Font("Microsoft YaHei", 8); cancelBtn.Text = "取消";
this.Controls.Add(statusLabel); cancelBtn.Size = new Size(60, 25);
cancelBtn.Location = new Point(320, 30);
// 取消按钮 cancelBtn.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
cancelBtn = new Button(); ? SystemColors.Control
cancelBtn.Text = "取消"; : Color.FromArgb(70, 70, 70);
cancelBtn.Size = new Size(60, 25); cancelBtn.ForeColor = ThemeManager.TextColor;
cancelBtn.Location = new Point(320, 30); cancelBtn.FlatStyle = FlatStyle.Flat;
cancelBtn.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light cancelBtn.FlatAppearance.BorderSize = 0;
? SystemColors.Control cancelBtn.Click += CancelBtn_Click;
: Color.FromArgb(70, 70, 70); this.Controls.Add(cancelBtn);
cancelBtn.ForeColor = ThemeManager.TextColor; }
cancelBtn.FlatStyle = FlatStyle.Flat;
cancelBtn.FlatAppearance.BorderSize = 0; public void UpdateDisplay()
cancelBtn.Click += CancelBtn_Click; {
this.Controls.Add(cancelBtn); nameLabel.Text = FileName;
} progressBar.Value = Progress;
statusLabel.Text = Status;
public void UpdateDisplay() this.Invalidate(); // 触发重绘
{ }
nameLabel.Text = FileName;
progressBar.Value = Progress; private void DownloadItem_Paint(object sender, PaintEventArgs e)
statusLabel.Text = Status; {
} // 自定义边框绘制
using (var pen = new Pen(ThemeManager.BorderColor, 1))
private void CancelBtn_Click(object sender, EventArgs e) {
{ e.Graphics.DrawRectangle(pen,
if (sender == null || e == null) return; new Rectangle(0, 0, this.Width - 1, this.Height - 1));
if (InvokeRequired) }
{ }
Invoke(new EventHandler(CancelBtn_Click), sender, e);
return; private void CancelBtn_Click(object sender, EventArgs e)
} {
if (sender == null || e == null) return;
try if (InvokeRequired)
{ {
DownloadManager.Instance.CancelDownload(this); Invoke(new EventHandler(CancelBtn_Click), sender, e);
Status = "已取消"; return;
UpdateDisplay(); }
}
catch (Exception ex) try
{ {
Status = $"取消失败: {ex.Message}"; DownloadManager.Instance.CancelDownload(this);
UpdateDisplay(); Status = "已取消";
} UpdateDisplay();
} }
} catch (Exception ex)
} {
Status = $"取消失败: {ex.Message}";
UpdateDisplay();
}
}
}
}

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
#nullable enable #nullable enable
using System; using System;
using System.Drawing; using System.Drawing;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
#include <windows.h> #include <windows.h>
#include <vector> #include <vector>
#include <fstream> #include <fstream>

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <vector> #include <vector>

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
#include <iostream> #include <iostream>
#include <filesystem> #include <filesystem>
#include <chrono> #include <chrono>

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.IO; using System.IO;
using System.Text; using System.Text;