Program.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using DevExpress.LookAndFeel;
  2. using DevExpress.Skins;
  3. using DevExpress.UserSkins;
  4. using DevExpress.XtraEditors;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Diagnostics;
  8. using System.Linq;
  9. using System.Reflection;
  10. using System.Windows.Forms;
  11. namespace XdCxRhDW.DataEmulation
  12. {
  13. internal static class Program
  14. {
  15. static Program()
  16. {
  17. AppDomain.CurrentDomain.SetData("PRIVATE_BINPATH", "AddIns;");
  18. var m = typeof(AppDomainSetup).GetMethod("UpdateContextProperty", BindingFlags.NonPublic | BindingFlags.Static);
  19. var funsion = typeof(AppDomain).GetMethod("GetFusionContext", BindingFlags.NonPublic | BindingFlags.Instance);
  20. m.Invoke(null, new object[] { funsion.Invoke(AppDomain.CurrentDomain, null), "PRIVATE_BINPATH", "AddIns;" });
  21. AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
  22. {
  23. var args = e.ExceptionObject as Exception;
  24. DxHelper.MsgBoxHelper.ShowError("出现未处理的异常,程序即将退出!");
  25. };
  26. Application.ThreadException += (sender, e) =>
  27. {
  28. DxHelper.MsgBoxHelper.ShowError(e.Exception.Message);
  29. };
  30. }
  31. /// <summary>
  32. /// The main entry point for the application.
  33. /// </summary>
  34. [STAThread]
  35. static void Main()
  36. {
  37. WindowsFormsSettings.AllowDpiScale = true;
  38. WindowsFormsSettings.AllowHoverAnimation = DevExpress.Utils.DefaultBoolean.True;
  39. WindowsFormsSettings.AllowDefaultSvgImages = DevExpress.Utils.DefaultBoolean.True;
  40. WindowsFormsSettings.AllowRoundedWindowCorners = DevExpress.Utils.DefaultBoolean.True;
  41. WindowsFormsSettings.AnimationMode = AnimationMode.EnableAll;
  42. WindowsFormsSettings.BackgroundSkinningMode = BackgroundSkinningMode.AllColors;
  43. WindowsFormsSettings.DefaultAllowHtmlDraw = true;
  44. WindowsFormsSettings.DefaultLookAndFeel.SetSkinStyle(SkinStyle.WXICompact);
  45. WindowsFormsSettings.DefaultFont = new System.Drawing.Font("微软雅黑", 10f);
  46. WindowsFormsSettings.SetPerMonitorDpiAware();
  47. if (Debugger.IsAttached)
  48. {
  49. //DevExpress23.2以上版本查看未本地化的资源
  50. //DevExpress.Utils.Localization.XtraLocalizer.EnableTraceSource();
  51. }
  52. Application.EnableVisualStyles();
  53. Application.SetCompatibleTextRenderingDefault(false);
  54. Application.Run(new Form1());
  55. }
  56. }
  57. }