@@ -428,10 +428,10 @@ private void MenuItemFontClick(object sender, EventArgs e)
428428 lock ( _lockObject )
429429 {
430430 txtContent . Font = dialog . Font ;
431- _settings . FontName = dialog . Font . Name ;
432- _settings . FontSize = dialog . Font . Size ;
433- _settings . FontStyle = dialog . Font . Style ;
434- _settings . FontUnit = dialog . Font . Unit ;
431+ _settings . Font . Name = dialog . Font . Name ;
432+ _settings . Font . Size = dialog . Font . Size ;
433+ _settings . Font . Style = dialog . Font . Style ;
434+ _settings . Font . Unit = dialog . Font . Unit ;
435435 SaveSettings ( _settings ) ;
436436 }
437437 }
@@ -471,10 +471,10 @@ private void MenuItemChangeIcon(object sender, EventArgs e)
471471 var result = form . ShowDialog ( this ) ;
472472 if ( result == DialogResult . OK )
473473 {
474- var imageFileName = ApplicationSettingsFile . GetImageFileName ( ) ;
474+ var imageFileInfo = ApplicationSettingsFile . GetImageFileName ( ) ;
475475 try
476476 {
477- File . Copy ( form . FileName , imageFileName , true ) ;
477+ File . Copy ( form . FileName , imageFileInfo . FullName , true ) ;
478478 }
479479 catch ( Exception ex )
480480 {
@@ -484,11 +484,11 @@ private void MenuItemChangeIcon(object sender, EventArgs e)
484484
485485 try
486486 {
487- SetImage ( imageFileName ) ;
487+ SetImage ( imageFileInfo . FullName ) ;
488488 }
489489 catch ( Exception ex )
490490 {
491- MessageBox . Show ( $ "Failed to load the file { imageFileName } .{ Environment . NewLine } { ex . Message } ", "Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
491+ MessageBox . Show ( $ "Failed to load the file { imageFileInfo . FullName } .{ Environment . NewLine } { ex . Message } ", "Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
492492 return ;
493493 }
494494
@@ -1368,8 +1368,21 @@ private void LoadTargetIcon()
13681368 }
13691369 else
13701370 {
1371- var imageFileName = ApplicationSettingsFile . GetImageFileName ( ) ;
1372- SetImage ( imageFileName ) ;
1371+ var imageFileInfo = ApplicationSettingsFile . GetImageFileName ( ) ;
1372+ if ( imageFileInfo . Exists )
1373+ {
1374+ SetImage ( imageFileInfo . FullName ) ;
1375+ }
1376+ else
1377+ {
1378+ btnTarget . Image ? . Dispose ( ) ;
1379+ btnTarget . Image = Properties . Resources . TargetButton ;
1380+ menuItemDefaultIcon . Checked = true ;
1381+ menuItemSystemCursor . Checked = false ;
1382+ menuItemChangeIcon . Checked = false ;
1383+ _settings . TargetIcon = TargetIconType . Default ;
1384+ SaveSettings ( _settings ) ;
1385+ }
13731386 }
13741387 }
13751388
@@ -1386,7 +1399,7 @@ private void SetImage(string fileName)
13861399
13871400 private void LoadSettings ( )
13881401 {
1389- _settings = ApplicationSettingsFile . Load ( ) ;
1402+ _settings = ApplicationSettingsFile . Read ( ) ;
13901403 _videoFileName = Path . Combine ( AssemblyUtils . AssemblyDirectory , _settings . VideoFileName ) ;
13911404 numericFps . Value = _settings . FPS ;
13921405 numericScale . Value = _settings . Scale ;
@@ -1402,7 +1415,7 @@ private void LoadSettings()
14021415 menuItemMagnifierEnabled . Checked = _settings . Magnifier . Enabled ;
14031416 cmbRefresh . SelectedIndex = _settings . RefreshImage ? 0 : 1 ;
14041417 cmbCaptureCursor . SelectedIndex = _settings . CaptureCursor ? 0 : 1 ;
1405- txtContent . Font = new Font ( _settings . FontName , _settings . FontSize , _settings . FontStyle , _settings . FontUnit ) ;
1418+ txtContent . Font = new Font ( _settings . Font . Name , _settings . Font . Size , _settings . Font . Style , _settings . Font . Unit ) ;
14061419 if ( ! _settings . ShowTextList )
14071420 {
14081421 splitTextContainer . Panel2Collapsed = true ;
0 commit comments