diff --git a/Form1.Designer.cs b/Form1.Designer.cs index e7122be..63a0c80 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -36,9 +36,10 @@ namespace SlideCombine // 主窗体设置 AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(600, 400); - Text = "PDF书签合并工具"; + ClientSize = new Size(700, 550); + Text = "PDF书签合并工具 v1.0"; StartPosition = FormStartPosition.CenterScreen; + BackColor = Color.FromArgb(240, 240, 240); // 创建控件 grpSourceFolder = new GroupBox(); @@ -61,21 +62,31 @@ namespace SlideCombine txtLog = new TextBox(); // 设置源文件夹组 - grpSourceFolder.Text = "PDF文件夹路径"; - grpSourceFolder.Location = new Point(10, 10); - grpSourceFolder.Size = new Size(580, 60); + grpSourceFolder.Text = "📁 PDF文件夹路径"; + grpSourceFolder.Location = new Point(15, 15); + grpSourceFolder.Size = new Size(670, 80); grpSourceFolder.TabStop = false; + grpSourceFolder.BackColor = Color.White; + grpSourceFolder.Font = new Font("Microsoft YaHei", 9F, FontStyle.Regular); - lblSourcePath.Text = "路径:"; - lblSourcePath.Location = new Point(10, 25); - lblSourcePath.Size = new Size(30, 23); + lblSourcePath.Text = "选择包含PDF文件夹的路径:"; + lblSourcePath.Location = new Point(15, 20); + lblSourcePath.Size = new Size(200, 23); + lblSourcePath.Font = new Font("Microsoft YaHei", 9F, FontStyle.Regular); - txtSourcePath.Location = new Point(45, 22); - txtSourcePath.Size = new Size(470, 23); + txtSourcePath.Location = new Point(15, 45); + txtSourcePath.Size = new Size(540, 25); + txtSourcePath.Font = new Font("Microsoft YaHei", 9F, FontStyle.Regular); + txtSourcePath.BorderStyle = BorderStyle.FixedSingle; btnBrowseSource.Text = "浏览"; - btnBrowseSource.Location = new Point(520, 20); - btnBrowseSource.Size = new Size(50, 25); + btnBrowseSource.Location = new Point(560, 44); + btnBrowseSource.Size = new Size(80, 27); + btnBrowseSource.Font = new Font("Microsoft YaHei", 9F, FontStyle.Regular); + btnBrowseSource.BackColor = Color.FromArgb(66, 139, 202); + btnBrowseSource.ForeColor = Color.White; + btnBrowseSource.FlatStyle = FlatStyle.Flat; + btnBrowseSource.FlatAppearance.BorderSize = 0; btnBrowseSource.Click += new EventHandler(btnBrowseSource_Click); grpSourceFolder.Controls.Add(lblSourcePath); @@ -83,21 +94,31 @@ namespace SlideCombine grpSourceFolder.Controls.Add(btnBrowseSource); // 设置输出文件夹组 - grpOutputFolder.Text = "TXT输出路径"; - grpOutputFolder.Location = new Point(10, 80); - grpOutputFolder.Size = new Size(580, 60); + grpOutputFolder.Text = "📄 TXT输出路径"; + grpOutputFolder.Location = new Point(15, 105); + grpOutputFolder.Size = new Size(670, 80); grpOutputFolder.TabStop = false; + grpOutputFolder.BackColor = Color.White; + grpOutputFolder.Font = new Font("Microsoft YaHei", 9F, FontStyle.Regular); - lblOutputPath.Text = "路径:"; - lblOutputPath.Location = new Point(10, 25); - lblOutputPath.Size = new Size(30, 23); + lblOutputPath.Text = "选择TXT文件输出路径:"; + lblOutputPath.Location = new Point(15, 20); + lblOutputPath.Size = new Size(200, 23); + lblOutputPath.Font = new Font("Microsoft YaHei", 9F, FontStyle.Regular); - txtOutputPath.Location = new Point(45, 22); - txtOutputPath.Size = new Size(470, 23); + txtOutputPath.Location = new Point(15, 45); + txtOutputPath.Size = new Size(540, 25); + txtOutputPath.Font = new Font("Microsoft YaHei", 9F, FontStyle.Regular); + txtOutputPath.BorderStyle = BorderStyle.FixedSingle; btnBrowseOutput.Text = "浏览"; - btnBrowseOutput.Location = new Point(520, 20); - btnBrowseOutput.Size = new Size(50, 25); + btnBrowseOutput.Location = new Point(560, 44); + btnBrowseOutput.Size = new Size(80, 27); + btnBrowseOutput.Font = new Font("Microsoft YaHei", 9F, FontStyle.Regular); + btnBrowseOutput.BackColor = Color.FromArgb(66, 139, 202); + btnBrowseOutput.ForeColor = Color.White; + btnBrowseOutput.FlatStyle = FlatStyle.Flat; + btnBrowseOutput.FlatAppearance.BorderSize = 0; btnBrowseOutput.Click += new EventHandler(btnBrowseOutput_Click); grpOutputFolder.Controls.Add(lblOutputPath); @@ -105,22 +126,38 @@ namespace SlideCombine grpOutputFolder.Controls.Add(btnBrowseOutput); // 设置按钮面板 - pnlButtons.Location = new Point(10, 150); - pnlButtons.Size = new Size(580, 40); + pnlButtons.Location = new Point(15, 195); + pnlButtons.Size = new Size(670, 50); + pnlButtons.BackColor = Color.Transparent; - btnMerge.Text = "合并书签"; - btnMerge.Location = new Point(10, 8); - btnMerge.Size = new Size(75, 25); + btnMerge.Text = "🚀 开始合并"; + btnMerge.Location = new Point(15, 10); + btnMerge.Size = new Size(120, 30); + btnMerge.Font = new Font("Microsoft YaHei", 10F, FontStyle.Bold); + btnMerge.BackColor = Color.FromArgb(92, 184, 92); + btnMerge.ForeColor = Color.White; + btnMerge.FlatStyle = FlatStyle.Flat; + btnMerge.FlatAppearance.BorderSize = 0; btnMerge.Click += new EventHandler(btnMerge_Click); - btnClear.Text = "清空"; - btnClear.Location = new Point(100, 8); - btnClear.Size = new Size(75, 25); + btnClear.Text = "🔄 清空"; + btnClear.Location = new Point(145, 10); + btnClear.Size = new Size(100, 30); + btnClear.Font = new Font("Microsoft YaHei", 9F, FontStyle.Regular); + btnClear.BackColor = Color.FromArgb(240, 173, 78); + btnClear.ForeColor = Color.White; + btnClear.FlatStyle = FlatStyle.Flat; + btnClear.FlatAppearance.BorderSize = 0; btnClear.Click += new EventHandler(btnClear_Click); - btnExit.Text = "退出"; - btnExit.Location = new Point(190, 8); - btnExit.Size = new Size(75, 25); + btnExit.Text = "❌ 退出"; + btnExit.Location = new Point(255, 10); + btnExit.Size = new Size(100, 30); + btnExit.Font = new Font("Microsoft YaHei", 9F, FontStyle.Regular); + btnExit.BackColor = Color.FromArgb(217, 83, 79); + btnExit.ForeColor = Color.White; + btnExit.FlatStyle = FlatStyle.Flat; + btnExit.FlatAppearance.BorderSize = 0; btnExit.Click += new EventHandler(btnExit_Click); pnlButtons.Controls.Add(btnMerge); @@ -128,20 +165,26 @@ namespace SlideCombine pnlButtons.Controls.Add(btnExit); // 设置进度组 - grpProgress.Text = "进度"; - grpProgress.Location = new Point(10, 200); - grpProgress.Size = new Size(580, 180); + grpProgress.Text = "📊 处理进度"; + grpProgress.Location = new Point(15, 255); + grpProgress.Size = new Size(670, 280); grpProgress.TabStop = false; + grpProgress.BackColor = Color.White; + grpProgress.Font = new Font("Microsoft YaHei", 9F, FontStyle.Regular); - progressBar.Location = new Point(10, 25); - progressBar.Size = new Size(560, 23); + progressBar.Location = new Point(15, 25); + progressBar.Size = new Size(640, 25); progressBar.Style = ProgressBarStyle.Continuous; + progressBar.ForeColor = Color.FromArgb(66, 139, 202); - txtLog.Location = new Point(10, 55); - txtLog.Size = new Size(560, 115); + txtLog.Location = new Point(15, 60); + txtLog.Size = new Size(640, 200); txtLog.Multiline = true; txtLog.ScrollBars = ScrollBars.Vertical; txtLog.ReadOnly = true; + txtLog.Font = new Font("Consolas", 9F, FontStyle.Regular); + txtLog.BackColor = Color.FromArgb(248, 248, 248); + txtLog.BorderStyle = BorderStyle.FixedSingle; grpProgress.Controls.Add(progressBar); grpProgress.Controls.Add(txtLog); diff --git a/Form1.cs b/Form1.cs index 3bdd215..7586040 100644 --- a/Form1.cs +++ b/Form1.cs @@ -33,11 +33,11 @@ namespace SlideCombine { using (FolderBrowserDialog dialog = new FolderBrowserDialog()) { - dialog.Description = "选择文件夹"; + dialog.Description = "请选择包含PDF文件夹的路径"; if (dialog.ShowDialog() == DialogResult.OK) { txtSourcePath.Text = dialog.SelectedPath; - Log($"选择的文件夹: {dialog.SelectedPath}"); + LogInfo($"已选择PDF路径: {dialog.SelectedPath}"); } } } @@ -46,11 +46,11 @@ namespace SlideCombine { using (FolderBrowserDialog dialog = new FolderBrowserDialog()) { - dialog.Description = "选择输出文件夹"; + dialog.Description = "请选择TXT文件的输出路径"; if (dialog.ShowDialog() == DialogResult.OK) { txtOutputPath.Text = dialog.SelectedPath; - Log($"输出文件夹: {dialog.SelectedPath}"); + LogInfo($"已选择输出路径: {dialog.SelectedPath}"); } } } @@ -61,10 +61,12 @@ namespace SlideCombine txtOutputPath.Clear(); txtLog.Clear(); progressBar.Value = 0; + LogInfo("界面已清空"); } private void btnExit_Click(object sender, EventArgs e) { + LogInfo("程序即将退出"); Application.Exit(); } @@ -154,7 +156,41 @@ namespace SlideCombine private void Log(string msg) { - txtLog.AppendText($"{msg}\r\n"); + string timestamp = DateTime.Now.ToString("HH:mm:ss"); + txtLog.AppendText($"[{timestamp}] {msg}\r\n"); + txtLog.ScrollToCaret(); + Application.DoEvents(); + } + + private void LogSuccess(string msg) + { + string timestamp = DateTime.Now.ToString("HH:mm:ss"); + txtLog.SelectionStart = txtLog.TextLength; + txtLog.SelectionColor = Color.Green; + txtLog.AppendText($"[{timestamp}] ✅ {msg}\r\n"); + txtLog.SelectionColor = txtLog.ForeColor; + txtLog.ScrollToCaret(); + Application.DoEvents(); + } + + private void LogError(string msg) + { + string timestamp = DateTime.Now.ToString("HH:mm:ss"); + txtLog.SelectionStart = txtLog.TextLength; + txtLog.SelectionColor = Color.Red; + txtLog.AppendText($"[{timestamp}] ❌ {msg}\r\n"); + txtLog.SelectionColor = txtLog.ForeColor; + txtLog.ScrollToCaret(); + Application.DoEvents(); + } + + private void LogInfo(string msg) + { + string timestamp = DateTime.Now.ToString("HH:mm:ss"); + txtLog.SelectionStart = txtLog.TextLength; + txtLog.SelectionColor = Color.Blue; + txtLog.AppendText($"[{timestamp}] ℹ️ {msg}\r\n"); + txtLog.SelectionColor = txtLog.ForeColor; txtLog.ScrollToCaret(); Application.DoEvents(); }