ExceptionForm.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Windows.Forms;
  3. using FastReport.Utils;
  4. namespace FastReport.Forms
  5. {
  6. /// <summary>
  7. /// Represents the FastReport exception form.
  8. /// </summary>
  9. public partial class ExceptionForm : BaseDialogForm
  10. {
  11. private void ExceptionForm_Shown(object sender, EventArgs e)
  12. {
  13. lblException.Width = ClientSize.Width - lblException.Left * 2;
  14. }
  15. private void btnCopyToClipboard_Click(object sender, EventArgs e)
  16. {
  17. string text = "FastReport.Net v" + Config.Version + "\r\n";
  18. text += lblException.Text + "\r\n";
  19. text += tbStack.Text;
  20. Clipboard.SetText(text);
  21. }
  22. /// <inheritdoc/>
  23. public override void Localize()
  24. {
  25. base.Localize();
  26. MyRes res = new MyRes("Forms,Exception");
  27. Text = res.Get("");
  28. lblHint.Text = res.Get("Hint");
  29. lblStack.Text = res.Get("Stack");
  30. btnCopyToClipboard.Text = res.Get("Copy");
  31. }
  32. /// <summary>
  33. /// Creates a new instance ofthe form.
  34. /// </summary>
  35. /// <param name="ex">The exception object which data to display in the form.</param>
  36. public ExceptionForm(Exception ex)
  37. {
  38. InitializeComponent();
  39. Localize();
  40. UIUtils.CheckRTL(this);
  41. lblException.Text = ex.Message;
  42. tbStack.Text = ex.StackTrace;
  43. if (ex.InnerException != null)
  44. {
  45. lblException.Text += "\r\nInner exception:\r\n" + ex.InnerException.Message;
  46. tbStack.Text = ex.InnerException.StackTrace + "\r\n" + tbStack.Text;
  47. }
  48. }
  49. }
  50. }