@@ -428,10 +428,10 @@ private void MenuItemFontClick(object sender, EventArgs e)
428
428
lock ( _lockObject )
429
429
{
430
430
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 ;
435
435
SaveSettings ( _settings ) ;
436
436
}
437
437
}
@@ -471,10 +471,10 @@ private void MenuItemChangeIcon(object sender, EventArgs e)
471
471
var result = form . ShowDialog ( this ) ;
472
472
if ( result == DialogResult . OK )
473
473
{
474
- var imageFileName = ApplicationSettingsFile . GetImageFileName ( ) ;
474
+ var imageFileInfo = ApplicationSettingsFile . GetImageFileName ( ) ;
475
475
try
476
476
{
477
- File . Copy ( form . FileName , imageFileName , true ) ;
477
+ File . Copy ( form . FileName , imageFileInfo . FullName , true ) ;
478
478
}
479
479
catch ( Exception ex )
480
480
{
@@ -484,11 +484,11 @@ private void MenuItemChangeIcon(object sender, EventArgs e)
484
484
485
485
try
486
486
{
487
- SetImage ( imageFileName ) ;
487
+ SetImage ( imageFileInfo . FullName ) ;
488
488
}
489
489
catch ( Exception ex )
490
490
{
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 ) ;
492
492
return ;
493
493
}
494
494
@@ -1368,8 +1368,21 @@ private void LoadTargetIcon()
1368
1368
}
1369
1369
else
1370
1370
{
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
+ }
1373
1386
}
1374
1387
}
1375
1388
@@ -1386,7 +1399,7 @@ private void SetImage(string fileName)
1386
1399
1387
1400
private void LoadSettings ( )
1388
1401
{
1389
- _settings = ApplicationSettingsFile . Load ( ) ;
1402
+ _settings = ApplicationSettingsFile . Read ( ) ;
1390
1403
_videoFileName = Path . Combine ( AssemblyUtils . AssemblyDirectory , _settings . VideoFileName ) ;
1391
1404
numericFps . Value = _settings . FPS ;
1392
1405
numericScale . Value = _settings . Scale ;
@@ -1402,7 +1415,7 @@ private void LoadSettings()
1402
1415
menuItemMagnifierEnabled . Checked = _settings . Magnifier . Enabled ;
1403
1416
cmbRefresh . SelectedIndex = _settings . RefreshImage ? 0 : 1 ;
1404
1417
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 ) ;
1406
1419
if ( ! _settings . ShowTextList )
1407
1420
{
1408
1421
splitTextContainer . Panel2Collapsed = true ;
0 commit comments