📄 showerrmessage.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net.Mail;
namespace Utility
{
/// <summary>
/// 显示错误窗体
/// </summary>
public partial class ShowErrMessage : Form
{
public ShowErrMessage(Exception ex)
{
InitializeComponent();
this.Text = Pub.SysTitle + "错误处理";
this.label1.Text = "此错误已被捕获\n您可将此错误报告发送给开发商,寻求更好的解决方案。";
this.txtErrInfo.Text = " " + ex.Message + "\n" +
ex.StackTrace;
}
private void btnSend_Click(object sender, EventArgs e)
{
this.label2.Text = "正在发送,请稍后...";
Application.DoEvents();
//发送错误报告,返回处理结果
string ErrInfo = " 客户名称:" + Pub.Company;
ErrInfo += "\n 软件系统:" + Application.ProductName;
ErrInfo += "\n 软件版本:" + Application.ProductVersion;
ErrInfo += "\n 操作系统:" + System.Environment.OSVersion;
ErrInfo += "\n NET版本:" + System.Environment.Version;
ErrInfo += "\n 内存使用:" + System.Environment.WorkingSet.ToString();
ErrInfo += "\n 堆栈跟踪:" + System.Environment.StackTrace;
ErrInfo += "\n 错误信息:" + this.txtErrInfo.Text.Trim();
this.label2.Text = Pub.SendErrToMail(ErrInfo) + ",可以关闭";
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
private void ShowErrMessage_Load(object sender, EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -