Add files via upload

This commit is contained in:
zsyg
2025-06-30 20:20:21 +08:00
committed by GitHub
parent 5651e944f9
commit d056c24a1b

View File

@@ -1,141 +1,144 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace AppStore namespace AppStore
{ {
public class AboutUserControl : UserControl public class AboutUserControl : UserControl
{ {
private PictureBox logo = null!; private PictureBox logo = null!;
private Label infoLabel = null!; private Label infoLabel = null!;
public AboutUserControl() public AboutUserControl()
{ {
InitializeComponent(); InitializeComponent();
} }
private void InitializeComponent() private void InitializeComponent()
{ {
this.Dock = DockStyle.Fill; this.Dock = DockStyle.Fill;
this.BackColor = Color.White; this.BackColor = ThemeManager.BackgroundColor;
this.Padding = new Padding(20); this.Padding = new Padding(20);
// 创建主布局面板 // 创建主布局面板
TableLayoutPanel mainLayout = new TableLayoutPanel(); TableLayoutPanel mainLayout = new TableLayoutPanel();
mainLayout.Dock = DockStyle.Fill; mainLayout.Dock = DockStyle.Fill;
mainLayout.ColumnCount = 1; mainLayout.BackColor = ThemeManager.BackgroundColor;
mainLayout.RowCount = 2; mainLayout.ColumnCount = 1;
mainLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); mainLayout.RowCount = 2;
mainLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); mainLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
mainLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); mainLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
mainLayout.Padding = new Padding(0, 20, 0, 20); mainLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
mainLayout.Padding = new Padding(0, 20, 0, 20);
// 初始化并添加应用图标
logo = new PictureBox(); // 初始化并添加应用图标
try logo = new PictureBox();
{ try
logo.Image = Image.FromFile("img/png/kortapp-z.png"); {
} logo.Image = Image.FromFile("img/png/kortapp-z.png");
catch (Exception ex) }
{ catch (Exception ex)
Logger.LogError($"无法加载应用图标: {ex.Message}"); {
logo.Image = SystemIcons.Application.ToBitmap(); Logger.LogError($"无法加载应用图标: {ex.Message}");
} logo.Image = SystemIcons.Application.ToBitmap();
logo.SizeMode = PictureBoxSizeMode.Zoom; }
logo.Width = 200; logo.SizeMode = PictureBoxSizeMode.Zoom;
logo.Height = 200; logo.Width = 200;
logo.Anchor = AnchorStyles.None; logo.Height = 200;
logo.Margin = new Padding(0, 0, 0, 20); logo.Anchor = AnchorStyles.None;
mainLayout.Controls.Add(logo, 0, 0); logo.Margin = new Padding(0, 0, 0, 20);
mainLayout.Controls.Add(logo, 0, 0);
// 初始化并添加应用信息
infoLabel = new Label(); // 初始化并添加应用信息
infoLabel.Text = "kortapp-z\n版本: 1.1.0\n作者: zs-yg\n一个简单、开源的应用商店\nkortapp-z是完全免费\n基于.NET8和C/C++的软件"; infoLabel = new Label();
infoLabel.Font = new Font("Microsoft YaHei", 12); infoLabel.Text = "kortapp-z\n版本: 1.1.1\n作者: zs-yg\n一个简单、开源的应用商店\nkortapp-z是完全免费\n基于.NET8和C/C++的软件";
infoLabel.AutoSize = false; infoLabel.Font = new Font("Microsoft YaHei", 12);
infoLabel.Width = 300; infoLabel.AutoSize = false;
infoLabel.Height = 130; // 增加高度确保文字完整显示 infoLabel.Width = 300;
infoLabel.TextAlign = ContentAlignment.MiddleCenter; infoLabel.Height = 130; // 增加高度确保文字完整显示
infoLabel.Anchor = AnchorStyles.None; infoLabel.TextAlign = ContentAlignment.MiddleCenter;
mainLayout.Controls.Add(infoLabel, 0, 1); infoLabel.Anchor = AnchorStyles.None;
mainLayout.Controls.Add(infoLabel, 0, 1);
// 调整主布局为3行
mainLayout.RowCount = 3; // 调整主布局为3行
mainLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); mainLayout.RowCount = 3;
mainLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); mainLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
mainLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); mainLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
mainLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
// 在底部添加GitHub链接区域
TableLayoutPanel githubPanel = new TableLayoutPanel(); // 在底部添加GitHub链接区域
githubPanel.Dock = DockStyle.Bottom; TableLayoutPanel githubPanel = new TableLayoutPanel();
githubPanel.Height = 60; githubPanel.Dock = DockStyle.Bottom;
githubPanel.ColumnCount = 3; githubPanel.BackColor = ThemeManager.BackgroundColor;
githubPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); githubPanel.Height = 60;
githubPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); githubPanel.ColumnCount = 3;
githubPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); githubPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
githubPanel.RowCount = 1; githubPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
githubPanel.Padding = new Padding(10); githubPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
githubPanel.RowCount = 1;
// 添加GitHub图标 githubPanel.Padding = new Padding(10);
PictureBox githubIcon = new PictureBox();
try // 添加GitHub图标
{ PictureBox githubIcon = new PictureBox();
githubIcon.Image = Image.FromFile("img/jpg/github.jpg"); try
} {
catch (Exception ex) githubIcon.Image = Image.FromFile("img/jpg/github.jpg");
{ }
Logger.LogError($"无法加载GitHub图标: {ex.Message}"); catch (Exception ex)
githubIcon.Image = SystemIcons.Application.ToBitmap(); {
} Logger.LogError($"无法加载GitHub图标: {ex.Message}");
githubIcon.SizeMode = PictureBoxSizeMode.Zoom; githubIcon.Image = SystemIcons.Application.ToBitmap();
githubIcon.Width = 30; }
githubIcon.Height = 30; githubIcon.SizeMode = PictureBoxSizeMode.Zoom;
githubIcon.Cursor = Cursors.Hand; githubIcon.Width = 30;
githubIcon.Click += (s, e) => { githubIcon.Height = 30;
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo githubIcon.Cursor = Cursors.Hand;
{ githubIcon.Click += (s, e) => {
FileName = "https://github.com/zs-yg/kortapp-z", System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
UseShellExecute = true {
}); FileName = "https://github.com/zs-yg/kortapp-z",
}; UseShellExecute = true
});
// 添加文字说明 };
Label githubLabel = new Label();
githubLabel.Text = "🤗🤗🤗开源地址 🌟 欢迎点star和提交pr 🚀"; // 添加文字说明
githubLabel.Font = new Font("Microsoft YaHei", 10); Label githubLabel = new Label();
githubLabel.AutoSize = true; githubLabel.Text = "🤗🤗🤗开源地址 🌟 欢迎点star和提交pr 🚀";
githubLabel.Margin = new Padding(10, 0, 0, 0); githubLabel.Font = new Font("Microsoft YaHei", 10);
githubLabel.AutoSize = true;
// 创建包含图标和文字的面板 githubLabel.Margin = new Padding(10, 0, 0, 0);
Panel linkPanel = new Panel();
linkPanel.AutoSize = true; // 创建包含图标和文字的面板
linkPanel.Controls.Add(githubIcon); Panel linkPanel = new Panel();
linkPanel.Controls.Add(githubLabel); linkPanel.AutoSize = true;
githubIcon.Location = new Point(0, 0); linkPanel.BackColor = ThemeManager.BackgroundColor;
githubLabel.Location = new Point(githubIcon.Width + 10, 5); linkPanel.Controls.Add(githubIcon);
linkPanel.Controls.Add(githubLabel);
// 将链接面板添加到中间列 githubIcon.Location = new Point(0, 0);
githubPanel.Controls.Add(linkPanel, 1, 0); githubLabel.Location = new Point(githubIcon.Width + 10, 5);
this.Controls.Add(mainLayout); // 将链接面板添加到中间列
this.Controls.Add(githubPanel); githubPanel.Controls.Add(linkPanel, 1, 0);
}
} this.Controls.Add(mainLayout);
this.Controls.Add(githubPanel);
// 保留原AboutForm作为容器(可选) }
public class AboutForm : Form }
{
public AboutForm() // 保留原AboutForm作为容器(可选)
{ public class AboutForm : Form
this.Text = "关于 kortapp-z"; {
this.Size = new Size(500, 400); public AboutForm()
this.StartPosition = FormStartPosition.CenterScreen; {
this.FormBorderStyle = FormBorderStyle.FixedDialog; this.Text = "关于 kortapp-z";
this.MaximizeBox = false; this.Size = new Size(500, 400);
this.MinimizeBox = false; this.StartPosition = FormStartPosition.CenterScreen;
this.FormBorderStyle = FormBorderStyle.FixedDialog;
var aboutControl = new AboutUserControl(); this.MaximizeBox = false;
this.Controls.Add(aboutControl); this.MinimizeBox = false;
}
} var aboutControl = new AboutUserControl();
} this.Controls.Add(aboutControl);
}
}
}