| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using System;
- using System.Drawing;
- using System.IO;
- using System.Windows.Forms;
- public class MinimalExportForm : FormBase
- {
- private string _filePath;
- public MinimalExportForm(string filePath)
- {
- _filePath = filePath;
- InitializeForm();
- }
- private void InitializeForm()
- {
- this.Text = "导出完成";
- this.Size = new Size(400, 250);
- this.StartPosition = FormStartPosition.CenterScreen;
- Panel panel = new Panel
- {
- Dock = DockStyle.Fill,
- Padding = new Padding(20)
- };
- // 成功图标
- Label lblSuccess = new Label
- {
- Text = "✓",
- Font = new Font("Arial", 24, FontStyle.Bold),
- ForeColor = Color.Green,
- Location = new Point(20, 20),
- AutoSize = true
- };
- // 成功消息
- Label lblMessage = new Label
- {
- Text = "数据导出成功!",
- Font = new Font("微软雅黑", 11, FontStyle.Bold),
- Location = new Point(60, 25),
- AutoSize = true
- };
- // 文件路径(简化显示)
- string displayPath = _filePath;
- if (_filePath.Length > 40)
- {
- displayPath = "..." + _filePath.Substring(_filePath.Length - 40);
- }
- Label lblPath = new Label
- {
- Text = displayPath,
- Location = new Point(20, 70),
- Size = new Size(350, 20),
- ForeColor = Color.DarkBlue
- };
- // 操作按钮
- Button btnOpen = new Button
- {
- Text = "打开文件",
- Size = new Size(80, 30),
- Location = new Point(80, 100)
- };
- btnOpen.Click += (s, e) => OpenFile();
- Button btnFolder = new Button
- {
- Text = "打开文件夹",
- Size = new Size(80, 30),
- Location = new Point(170, 100)
- };
- btnFolder.Click += (s, e) => OpenFolder();
- Button btnClose = new Button
- {
- Text = "关闭",
- Size = new Size(80, 30),
- Location = new Point(260, 100)
- };
- btnClose.Click += (s, e) => this.Close();
- panel.Controls.Add(lblSuccess);
- panel.Controls.Add(lblMessage);
- panel.Controls.Add(lblPath);
- panel.Controls.Add(btnOpen);
- panel.Controls.Add(btnFolder);
- panel.Controls.Add(btnClose);
- this.Controls.Add(panel);
- }
- private void OpenFile()
- {
- if (File.Exists(_filePath))
- {
- System.Diagnostics.Process.Start(_filePath);
- }
- }
- private void OpenFolder()
- {
- if (File.Exists(_filePath))
- {
- string argument = $"/select, \"{_filePath}\"";
- System.Diagnostics.Process.Start("explorer.exe", argument);
- }
- }
- private void InitializeComponent()
- {
- this.SuspendLayout();
- //
- // MinimalExportForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.ClientSize = new System.Drawing.Size(284, 263);
- this.Name = "MinimalExportForm";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "导出";
- this.ResumeLayout(false);
- this.PerformLayout();
- }
- }
|