主要改进: - 重新设计用户界面,采用标签页展示不同类型的系统信息 - 实现全面的系统信息检测(操作系统版本、架构、启动信息等) - 添加详细的硬件配置检测(CPU、内存、磁盘、显卡等) - 集成网络环境检测(本地网络、公网IP、连接状态等) - 实现软件环境扫描(.NET版本、浏览器、已安装软件等) - 添加环境变量检测和导出报告功能 - 保留原有的.NET Framework 4.8环境检测功能 - 优化用户界面体验,支持实时进度显示 功能特点: - 一键检测所有系统环境信息 - 分类展示检测结果,便于查阅 - 支持导出完整检测报告为文本文件 - 异步执行检测,避免界面卡顿 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
214 lines
7.8 KiB
C#
214 lines
7.8 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Environmental_testing
|
|
{
|
|
partial class Form1
|
|
{
|
|
/// <summary>
|
|
/// Required designer variable.
|
|
/// </summary>
|
|
private System.ComponentModel.IContainer components = null;
|
|
|
|
/// <summary>
|
|
/// Clean up any resources being used.
|
|
/// </summary>
|
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing && (components != null))
|
|
{
|
|
components.Dispose();
|
|
}
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
#region Windows Form Designer generated code
|
|
|
|
/// <summary>
|
|
/// Required method for Designer support - do not modify
|
|
/// the contents of this method with the code editor.
|
|
/// </summary>
|
|
private void InitializeComponent()
|
|
{
|
|
components = new System.ComponentModel.Container();
|
|
|
|
// 主窗体设置
|
|
AutoScaleMode = AutoScaleMode.Font;
|
|
ClientSize = new Size(800, 700);
|
|
Text = "系统环境检测工具";
|
|
StartPosition = FormStartPosition.CenterScreen;
|
|
|
|
// 创建控件
|
|
pnlButtons = new Panel();
|
|
btnDetect = new Button();
|
|
btnExport = new Button();
|
|
btnClear = new Button();
|
|
btnExit = new Button();
|
|
|
|
grpProgress = new GroupBox();
|
|
progressBar = new ProgressBar();
|
|
txtLog = new TextBox();
|
|
|
|
// 环境信息显示区域
|
|
tabControl = new TabControl();
|
|
tabSystem = new TabPage("系统信息");
|
|
tabHardware = new TabPage("硬件信息");
|
|
tabNetwork = new TabPage("网络信息");
|
|
tabSoftware = new TabPage("软件环境");
|
|
|
|
// 系统信息控件
|
|
grpSystemInfo = new GroupBox();
|
|
txtSystemInfo = new TextBox();
|
|
|
|
// 硬件信息控件
|
|
grpHardwareInfo = new GroupBox();
|
|
txtHardwareInfo = new TextBox();
|
|
|
|
// 网络信息控件
|
|
grpNetworkInfo = new GroupBox();
|
|
txtNetworkInfo = new TextBox();
|
|
|
|
// 软件环境控件
|
|
grpSoftwareInfo = new GroupBox();
|
|
txtSoftwareInfo = new TextBox();
|
|
|
|
// 设置按钮面板
|
|
pnlButtons.Location = new Point(10, 10);
|
|
pnlButtons.Size = new Size(780, 40);
|
|
|
|
btnDetect.Text = "开始检测";
|
|
btnDetect.Location = new Point(10, 8);
|
|
btnDetect.Size = new Size(100, 25);
|
|
btnDetect.Click += new EventHandler(btnDetect_Click);
|
|
|
|
btnExport.Text = "导出报告";
|
|
btnExport.Location = new Point(120, 8);
|
|
btnExport.Size = new Size(100, 25);
|
|
btnExport.Click += new EventHandler(btnExport_Click);
|
|
|
|
btnClear.Text = "清空日志";
|
|
btnClear.Location = new Point(230, 8);
|
|
btnClear.Size = new Size(100, 25);
|
|
btnClear.Click += new EventHandler(btnClear_Click);
|
|
|
|
btnExit.Text = "退出";
|
|
btnExit.Location = new Point(340, 8);
|
|
btnExit.Size = new Size(75, 25);
|
|
btnExit.Click += new EventHandler(btnExit_Click);
|
|
|
|
pnlButtons.Controls.Add(btnDetect);
|
|
pnlButtons.Controls.Add(btnExport);
|
|
pnlButtons.Controls.Add(btnClear);
|
|
pnlButtons.Controls.Add(btnExit);
|
|
|
|
// 设置标签控件
|
|
tabControl.Location = new Point(10, 60);
|
|
tabControl.Size = new Size(780, 450);
|
|
tabControl.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
|
|
// 系统信息标签页
|
|
grpSystemInfo.Text = "操作系统信息";
|
|
grpSystemInfo.Dock = DockStyle.Fill;
|
|
txtSystemInfo.Dock = DockStyle.Fill;
|
|
txtSystemInfo.Multiline = true;
|
|
txtSystemInfo.ScrollBars = ScrollBars.Vertical;
|
|
txtSystemInfo.ReadOnly = true;
|
|
txtSystemInfo.Font = new Font("Consolas", 9F);
|
|
grpSystemInfo.Controls.Add(txtSystemInfo);
|
|
tabSystem.Controls.Add(grpSystemInfo);
|
|
|
|
// 硬件信息标签页
|
|
grpHardwareInfo.Text = "硬件配置信息";
|
|
grpHardwareInfo.Dock = DockStyle.Fill;
|
|
txtHardwareInfo.Dock = DockStyle.Fill;
|
|
txtHardwareInfo.Multiline = true;
|
|
txtHardwareInfo.ScrollBars = ScrollBars.Vertical;
|
|
txtHardwareInfo.ReadOnly = true;
|
|
txtHardwareInfo.Font = new Font("Consolas", 9F);
|
|
grpHardwareInfo.Controls.Add(txtHardwareInfo);
|
|
tabHardware.Controls.Add(grpHardwareInfo);
|
|
|
|
// 网络信息标签页
|
|
grpNetworkInfo.Text = "网络环境信息";
|
|
grpNetworkInfo.Dock = DockStyle.Fill;
|
|
txtNetworkInfo.Dock = DockStyle.Fill;
|
|
txtNetworkInfo.Multiline = true;
|
|
txtNetworkInfo.ScrollBars = ScrollBars.Vertical;
|
|
txtNetworkInfo.ReadOnly = true;
|
|
txtNetworkInfo.Font = new Font("Consolas", 9F);
|
|
grpNetworkInfo.Controls.Add(txtNetworkInfo);
|
|
tabNetwork.Controls.Add(grpNetworkInfo);
|
|
|
|
// 软件环境标签页
|
|
grpSoftwareInfo.Text = "软件环境信息";
|
|
grpSoftwareInfo.Dock = DockStyle.Fill;
|
|
txtSoftwareInfo.Dock = DockStyle.Fill;
|
|
txtSoftwareInfo.Multiline = true;
|
|
txtSoftwareInfo.ScrollBars = ScrollBars.Vertical;
|
|
txtSoftwareInfo.ReadOnly = true;
|
|
txtSoftwareInfo.Font = new Font("Consolas", 9F);
|
|
grpSoftwareInfo.Controls.Add(txtSoftwareInfo);
|
|
tabSoftware.Controls.Add(grpSoftwareInfo);
|
|
|
|
tabControl.TabPages.Add(tabSystem);
|
|
tabControl.TabPages.Add(tabHardware);
|
|
tabControl.TabPages.Add(tabNetwork);
|
|
tabControl.TabPages.Add(tabSoftware);
|
|
|
|
// 设置进度组
|
|
grpProgress.Text = "检测进度";
|
|
grpProgress.Location = new Point(10, 520);
|
|
grpProgress.Size = new Size(780, 150);
|
|
grpProgress.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
grpProgress.TabStop = false;
|
|
|
|
progressBar.Location = new Point(10, 25);
|
|
progressBar.Size = new Size(760, 23);
|
|
progressBar.Style = ProgressBarStyle.Continuous;
|
|
|
|
txtLog.Location = new Point(10, 55);
|
|
txtLog.Size = new Size(760, 85);
|
|
txtLog.Multiline = true;
|
|
txtLog.ScrollBars = ScrollBars.Vertical;
|
|
txtLog.ReadOnly = true;
|
|
txtLog.Font = new Font("Consolas", 8F);
|
|
|
|
grpProgress.Controls.Add(progressBar);
|
|
grpProgress.Controls.Add(txtLog);
|
|
|
|
// 添加所有控件到窗体
|
|
Controls.Add(pnlButtons);
|
|
Controls.Add(tabControl);
|
|
Controls.Add(grpProgress);
|
|
}
|
|
|
|
#endregion
|
|
|
|
private Panel pnlButtons;
|
|
private Button btnDetect;
|
|
private Button btnExport;
|
|
private Button btnClear;
|
|
private Button btnExit;
|
|
private GroupBox grpProgress;
|
|
private ProgressBar progressBar;
|
|
private TextBox txtLog;
|
|
|
|
// 环境信息显示控件
|
|
private TabControl tabControl;
|
|
private TabPage tabSystem;
|
|
private TabPage tabHardware;
|
|
private TabPage tabNetwork;
|
|
private TabPage tabSoftware;
|
|
private GroupBox grpSystemInfo;
|
|
private TextBox txtSystemInfo;
|
|
private GroupBox grpHardwareInfo;
|
|
private TextBox txtHardwareInfo;
|
|
private GroupBox grpNetworkInfo;
|
|
private TextBox txtNetworkInfo;
|
|
private GroupBox grpSoftwareInfo;
|
|
private TextBox txtSoftwareInfo;
|
|
}
|
|
}
|