@@ -1229,17 +1229,26 @@ private void BtnSwitchTheme_Click(object sender, RoutedEventArgs e)
12291229 BtnExit . Foreground = Brushes . White ;
12301230 GridBackgroundCover . Background = new SolidColorBrush ( StringToColor ( "#FFF2F2F2" ) ) ;
12311231 ThemeManager . Current . ApplicationTheme = ApplicationTheme . Dark ;
1232+ SetDarkColors ( ) ; //在浅色背景上使用深色墨迹
12321233 if ( inkColor == 0 )
12331234 {
12341235 inkCanvas . DefaultDrawingAttributes . Color = Colors . White ;
12351236 }
1237+ else if ( inkColor == 1 )
1238+ {
1239+ BtnColorRed_Click ( null , null ) ;
1240+ }
12361241 else if ( inkColor == 2 )
12371242 {
1238- inkCanvas . DefaultDrawingAttributes . Color = StringToColor ( "#FF1ED760" ) ;
1243+ BtnColorGreen_Click ( null , null ) ;
1244+ }
1245+ else if ( inkColor == 3 )
1246+ {
1247+ BtnColorBlue_Click ( null , null ) ;
12391248 }
12401249 else if ( inkColor == 4 )
12411250 {
1242- inkCanvas . DefaultDrawingAttributes . Color = StringToColor ( "#FFFFC000" ) ;
1251+ BtnColorYellow_Click ( null , null ) ;
12431252 }
12441253 }
12451254 else
@@ -1252,17 +1261,26 @@ private void BtnSwitchTheme_Click(object sender, RoutedEventArgs e)
12521261 BtnExit . Foreground = Brushes . Black ;
12531262 GridBackgroundCover . Background = new SolidColorBrush ( StringToColor ( "#FF1A1A1A" ) ) ;
12541263 ThemeManager . Current . ApplicationTheme = ApplicationTheme . Light ;
1264+ SetLightColors ( ) ; //在深色背景上使用浅色墨迹
12551265 if ( inkColor == 0 )
12561266 {
1257- inkCanvas . DefaultDrawingAttributes . Color = Colors . Black ;
1267+ inkCanvas . DefaultDrawingAttributes . Color = Colors . White ;
1268+ }
1269+ else if ( inkColor == 1 )
1270+ {
1271+ BtnColorRed_Click ( null , null ) ;
12581272 }
12591273 else if ( inkColor == 2 )
12601274 {
1261- inkCanvas . DefaultDrawingAttributes . Color = StringToColor ( "#FF169141" ) ;
1275+ BtnColorGreen_Click ( null , null ) ;
1276+ }
1277+ else if ( inkColor == 3 )
1278+ {
1279+ BtnColorBlue_Click ( null , null ) ;
12621280 }
12631281 else if ( inkColor == 4 )
12641282 {
1265- inkCanvas . DefaultDrawingAttributes . Color = StringToColor ( "#FFF38B00" ) ;
1283+ BtnColorYellow_Click ( null , null ) ;
12661284 }
12671285 }
12681286 if ( ! Settings . Appearance . IsTransparentButtonBackground )
@@ -1539,17 +1557,15 @@ private void BtnColorRed_Click(object sender, RoutedEventArgs e)
15391557 {
15401558 inkColor = 1 ;
15411559 forceEraser = false ;
1542- inkCanvas . DefaultDrawingAttributes . Color = Colors . Red ;
15431560 if ( BtnSwitchTheme . Content . ToString ( ) == "浅色" )
15441561 {
1545- inkCanvas . DefaultDrawingAttributes . Color = StringToColor ( "#FFFF3333" ) ;
1546- BtnColorRed . Background = new SolidColorBrush ( StringToColor ( "#FFFF3333" ) ) ;
1562+ SetDarkColors ( ) ; //在浅色背景上使用深色墨迹
15471563 }
15481564 else
15491565 {
1550- inkCanvas . DefaultDrawingAttributes . Color = Colors . Red ;
1551- BtnColorRed . Background = Brushes . Red ;
1566+ SetLightColors ( ) ; //在深色背景上使用浅色墨迹
15521567 }
1568+ inkCanvas . DefaultDrawingAttributes . Color = ( ( SolidColorBrush ) BtnColorRed . Background ) . Color ;
15531569
15541570 ColorSwitchCheck ( ) ;
15551571 }
@@ -1560,14 +1576,13 @@ private void BtnColorGreen_Click(object sender, RoutedEventArgs e)
15601576 forceEraser = false ;
15611577 if ( BtnSwitchTheme . Content . ToString ( ) == "浅色" )
15621578 {
1563- inkCanvas . DefaultDrawingAttributes . Color = StringToColor ( "#FF1ED760" ) ;
1564- BtnColorGreen . Background = new SolidColorBrush ( StringToColor ( "#FF1ED760" ) ) ;
1579+ SetDarkColors ( ) ; //在浅色背景上使用深色墨迹
15651580 }
15661581 else
15671582 {
1568- inkCanvas . DefaultDrawingAttributes . Color = StringToColor ( "#FF169141" ) ;
1569- BtnColorGreen . Background = new SolidColorBrush ( StringToColor ( "#FF169141" ) ) ;
1583+ SetLightColors ( ) ; //在深色背景上使用浅色墨迹
15701584 }
1585+ inkCanvas . DefaultDrawingAttributes . Color = ( ( SolidColorBrush ) BtnColorGreen . Background ) . Color ;
15711586
15721587 ColorSwitchCheck ( ) ;
15731588 }
@@ -1576,7 +1591,7 @@ private void BtnColorBlue_Click(object sender, RoutedEventArgs e)
15761591 {
15771592 inkColor = 3 ;
15781593 forceEraser = false ;
1579- inkCanvas . DefaultDrawingAttributes . Color = StringToColor ( "#FF239AD6" ) ;
1594+ inkCanvas . DefaultDrawingAttributes . Color = ( ( SolidColorBrush ) BtnColorBlue . Background ) . Color ;
15801595
15811596 ColorSwitchCheck ( ) ;
15821597 }
@@ -1587,14 +1602,13 @@ private void BtnColorYellow_Click(object sender, RoutedEventArgs e)
15871602 forceEraser = false ;
15881603 if ( BtnSwitchTheme . Content . ToString ( ) == "浅色" )
15891604 {
1590- inkCanvas . DefaultDrawingAttributes . Color = StringToColor ( "#FFFFC000" ) ;
1591- BtnColorYellow . Background = new SolidColorBrush ( StringToColor ( "#FFFFC000" ) ) ;
1605+ SetDarkColors ( ) ; //在浅色背景上使用深色墨迹
15921606 }
15931607 else
15941608 {
1595- inkCanvas . DefaultDrawingAttributes . Color = StringToColor ( "#FFF38B00" ) ;
1596- BtnColorYellow . Background = new SolidColorBrush ( StringToColor ( "#FFF38B00" ) ) ;
1609+ SetLightColors ( ) ; //在深色背景上使用浅色墨迹
15971610 }
1611+ inkCanvas . DefaultDrawingAttributes . Color = ( ( SolidColorBrush ) BtnColorYellow . Background ) . Color ;
15981612
15991613 ColorSwitchCheck ( ) ;
16001614 }
@@ -2868,8 +2882,8 @@ private void ComboBoxEraserSize_SelectionChanged(object sender, SelectionChanged
28682882 Settings . Canvas . EraserSize = ComboBoxEraserSize . SelectedIndex ;
28692883 SaveSettingsToFile ( ) ;
28702884 }
2871-
2872-
2885+
2886+
28732887 private void ComboBoxEraserType_OnSelectionChanged ( object sender , SelectionChangedEventArgs e )
28742888 {
28752889 if ( ! isLoaded ) return ;
@@ -5836,6 +5850,42 @@ private void UpdateIndexInfoDisplay()
58365850 }
58375851 }
58385852
5853+ private void SetLightColors ( )
5854+ {
5855+ if ( File . Exists ( App . RootPath + "Colors\\ Light.ini" ) )
5856+ {
5857+ string [ ] lightColors = File . ReadAllLines ( App . RootPath + "Colors\\ Light.ini" ) ;
5858+ BtnColorRed . Background = new SolidColorBrush ( StringToColor ( lightColors [ 0 ] ) ) ;
5859+ BtnColorGreen . Background = new SolidColorBrush ( StringToColor ( lightColors [ 1 ] ) ) ;
5860+ BtnColorBlue . Background = new SolidColorBrush ( StringToColor ( lightColors [ 2 ] ) ) ;
5861+ BtnColorYellow . Background = new SolidColorBrush ( StringToColor ( lightColors [ 3 ] ) ) ;
5862+ }
5863+ else
5864+ {
5865+ BtnColorRed . Background = new SolidColorBrush ( StringToColor ( "#FFFF3333" ) ) ;
5866+ BtnColorGreen . Background = new SolidColorBrush ( StringToColor ( "#FF1ED760" ) ) ;
5867+ BtnColorYellow . Background = new SolidColorBrush ( StringToColor ( "#FFFFC000" ) ) ;
5868+ }
5869+ }
5870+
5871+ private void SetDarkColors ( )
5872+ {
5873+ if ( File . Exists ( App . RootPath + "Colors\\ Dark.ini" ) )
5874+ {
5875+ string [ ] darkColors = File . ReadAllLines ( App . RootPath + "Colors\\ Dark.ini" ) ;
5876+ BtnColorRed . Background = new SolidColorBrush ( StringToColor ( darkColors [ 0 ] ) ) ;
5877+ BtnColorGreen . Background = new SolidColorBrush ( StringToColor ( darkColors [ 1 ] ) ) ;
5878+ BtnColorBlue . Background = new SolidColorBrush ( StringToColor ( darkColors [ 2 ] ) ) ;
5879+ BtnColorYellow . Background = new SolidColorBrush ( StringToColor ( darkColors [ 3 ] ) ) ;
5880+ }
5881+ else
5882+ {
5883+ BtnColorRed . Background = new SolidColorBrush ( Colors . Red ) ;
5884+ BtnColorGreen . Background = new SolidColorBrush ( StringToColor ( "#FF169141" ) ) ;
5885+ BtnColorYellow . Background = new SolidColorBrush ( StringToColor ( "#FFF38B00" ) ) ;
5886+ }
5887+ }
5888+
58395889 #endregion Whiteboard Controls
58405890
58415891 #region Simulate Pen Pressure & Ink To Shape
0 commit comments