commit 1883e9ba774be9b2e8fdb4da71cfcd948c421e75 Author: timxx <3337598077@qq.com> Date: Sat Sep 19 23:50:45 2026 +0800 字体预览工具 v1.0.0 初始版本 diff --git a/Assets/app.ico b/Assets/app.ico new file mode 100644 index 0000000..cbe2dd1 Binary files /dev/null and b/Assets/app.ico differ diff --git a/FontPreview/AboutDialog.cs b/FontPreview/AboutDialog.cs new file mode 100644 index 0000000..9f23ae7 --- /dev/null +++ b/FontPreview/AboutDialog.cs @@ -0,0 +1,70 @@ +using System; +using System.Drawing; +using System.Reflection; +using System.Windows.Forms; + +namespace FontPreview +{ + /// + /// 关于对话框:显示版本、功能简介与技术说明。独立窗体,不影响主程序逻辑。 + /// + public class AboutDialog : Form + { + public AboutDialog() + { + Text = "关于"; + FormBorderStyle = FormBorderStyle.FixedDialog; + MaximizeBox = false; + MinimizeBox = false; + StartPosition = FormStartPosition.CenterParent; + ClientSize = new Size(460, 320); + Font = new Font("Microsoft YaHei UI", 9f); + + Assembly asm = Assembly.GetExecutingAssembly(); + string ver = asm.GetName().Version != null ? asm.GetName().Version.ToString() : "1.0"; + + Label title = new Label + { + Text = AppInfo.FullTitle, + Font = new Font("Microsoft YaHei UI", 14f, FontStyle.Bold), + Location = new Point(18, 16), + Size = new Size(420, 30) + }; + + TextBox body = new TextBox + { + Multiline = true, + ReadOnly = true, + ScrollBars = ScrollBars.Vertical, + Location = new Point(18, 56), + Size = new Size(424, 218), + BackColor = Color.White, + BorderStyle = BorderStyle.FixedSingle, + Text = + "免安装字体预览 / 批量管理工具\r\n\r\n" + + "主要功能:\r\n" + + "• 直接预览未安装的 TTF / OTF / TTC 字体\r\n" + + "• 卡片式批量预览,后台渲染、可随时停止\r\n" + + "• 绿色快捷方式安装 / 注册表安装双模式\r\n" + + "• 批量移动、批量重命名、标签与分类管理\r\n" + + "• 支持局域网 / NAS 网络共享盘字体\r\n" + + "• 导出系统字体、自定义字色底色与字号\r\n\r\n" + + "技术:.NET WinForms,PrivateFontCollection 免加载预览,完全离线运行。\r\n\r\n" + + "提示:右键“预览文字”框可一键填入中文样例。" + }; + + Button ok = new Button + { + Text = "确定", + DialogResult = DialogResult.OK, + Location = new Point(360, 284), + Size = new Size(82, 28) + }; + + Controls.Add(title); + Controls.Add(body); + Controls.Add(ok); + AcceptButton = ok; + } + } +} diff --git a/FontPreview/AppInfo.cs b/FontPreview/AppInfo.cs new file mode 100644 index 0000000..02969d0 --- /dev/null +++ b/FontPreview/AppInfo.cs @@ -0,0 +1,25 @@ +using System.Reflection; + +namespace FontPreview +{ + /// + /// 全局应用信息:软件名、版本号集中在此,其他地方一律引用,不硬编码。 + /// + public static class AppInfo + { + public const string AppName = "字体预览工具"; + + public static string Version + { + get + { + var v = Assembly.GetExecutingAssembly().GetName().Version; + if (v == null) return "1.0.0"; + // 只显示 3 级版本号 + return v.Major + "." + v.Minor + "." + v.Build; + } + } + + public static string FullTitle => AppName + " v" + Version; + } +} diff --git a/FontPreview/CompareDialog.cs b/FontPreview/CompareDialog.cs new file mode 100644 index 0000000..d2f7856 --- /dev/null +++ b/FontPreview/CompareDialog.cs @@ -0,0 +1,187 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Windows.Forms; + +namespace FontPreview +{ + /// + /// 字体对比对话框。 + /// 模式一(showList=true):把已加入对比列表的多个字体纵向滚动排列,同一文字/字号并排渲染。 + /// 模式二(showList=false):从全部字体里选两个下拉框对比。 + /// + public class CompareDialog : Form + { + private List items; + private bool listMode; + private ComboBox cboA; + private ComboBox cboB; + private TextBox txtText; + private NumericUpDown numSize; + private PictureBox picA; + private PictureBox picB; + private Label lblNameA; + private Label lblNameB; + private Panel scrollPanel; + private List listPics = new List(); + private List