@@ -56,12 +56,10 @@ public partial class MainForm : Form, IMessageFilter
5656 private AccurateTimer _writeVideoFrameTimer ;
5757
5858
59- public MainForm ( )
59+ public MainForm ( ApplicationSettings settings )
6060 {
6161 InitializeComponent ( ) ;
62-
63- AppDomain . CurrentDomain . UnhandledException += OnCurrentDomainUnhandledException ;
64- Application . ThreadException += OnThreadException ;
62+
6563 using var currentProcess = Process . GetCurrentProcess ( ) ;
6664
6765 magnifier . BorderWidth = 1 ;
@@ -86,6 +84,7 @@ public MainForm()
8684 _startRecordingTime = null ;
8785 _image = null ;
8886 _videoWriter = new VideoFileWriter ( ) ;
87+ _settings = settings ;
8988 }
9089
9190 protected override void OnLoad ( EventArgs e )
@@ -546,6 +545,12 @@ private void MenuItemCheckedClick(object sender, EventArgs e)
546545 _settings . Magnifier . Enabled = menuItem . Checked ;
547546 }
548547 break ;
548+
549+ case "menuItemHighDpiSupport" :
550+ {
551+ _settings . HighDpiSupport = menuItem . Checked ;
552+ }
553+ break ;
549554 }
550555 SaveSettings ( _settings ) ;
551556 }
@@ -1399,7 +1404,6 @@ private void SetImage(string fileName)
13991404
14001405 private void LoadSettings ( )
14011406 {
1402- _settings = ApplicationSettingsFile . Read ( ) ;
14031407 _videoFileName = Path . Combine ( AssemblyUtils . AssemblyDirectory , _settings . VideoFileName ) ;
14041408 numericFps . Value = _settings . FPS ;
14051409 numericScale . Value = _settings . Scale ;
@@ -1413,6 +1417,7 @@ private void LoadSettings()
14131417 menuItemNotRepeated . Checked = _settings . NotRepeatedNewItems ;
14141418 menuItemAlwaysRefreshTabs . Checked = _settings . AlwaysRefreshTabs ;
14151419 menuItemMagnifierEnabled . Checked = _settings . Magnifier . Enabled ;
1420+ menuItemHighDpiSupport . Checked = _settings . HighDpiSupport ;
14161421 cmbRefresh . SelectedIndex = _settings . RefreshImage ? 0 : 1 ;
14171422 cmbCaptureCursor . SelectedIndex = _settings . CaptureCursor ? 0 : 1 ;
14181423 txtContent . Font = new Font ( _settings . Font . Name , _settings . Font . Size , _settings . Font . Style , _settings . Font . Unit ) ;
@@ -1434,14 +1439,5 @@ private void SaveSettings(ApplicationSettings settings)
14341439 MessageBox . Show ( $ "Failed to save the settings.{ Environment . NewLine } { e . Message } ", "Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
14351440 }
14361441 }
1437-
1438- private void OnCurrentDomainUnhandledException ( object sender , UnhandledExceptionEventArgs e )
1439- {
1440- var ex = e . ExceptionObject as Exception ?? new Exception ( "OnCurrentDomainUnhandledException" ) ;
1441- OnThreadException ( sender , new ThreadExceptionEventArgs ( ex ) ) ;
1442- }
1443-
1444- private void OnThreadException ( object sender , ThreadExceptionEventArgs e ) =>
1445- MessageBox . Show ( e . Exception . Message , AssemblyUtils . AssemblyTitle , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
14461442 }
14471443}
0 commit comments