@@ -189,7 +189,6 @@ public void AutoDropShadow()
189189 RemoveDropShadowEffectFromCurrentTheme ( ) ;
190190 if ( _settings . UseDropShadowEffect )
191191 {
192- //RemoveDropShadowEffectFromCurrentTheme();
193192 if ( BlurEnabled )
194193 {
195194 SetWindowCornerPreference ( "Round" ) ;
@@ -202,7 +201,6 @@ public void AutoDropShadow()
202201 }
203202 else
204203 {
205- //RemoveDropShadowEffectFromCurrentTheme();
206204 if ( BlurEnabled )
207205 {
208206 SetWindowCornerPreference ( "Default" ) ;
@@ -235,39 +233,6 @@ public void SetWindowCornerPreference(string cornerType)
235233 } , DispatcherPriority . Normal ) ;
236234 }
237235
238-
239- //public void SetCornerForWindow()
240- //{
241- // Application.Current.Dispatcher.Invoke(() =>
242- // {
243- // var dict = GetThemeResourceDictionary(_settings.Theme);
244- // if (dict == null)
245- // return;
246-
247- // System.Windows.Window mainWindow = Application.Current.MainWindow;
248- // if (mainWindow == null)
249- // return;
250-
251- // if (dict.Contains("CornerType") && dict["CornerType"] is string cornerMode)
252- // {
253- // DWM_WINDOW_CORNER_PREFERENCE preference = cornerMode switch
254- // {
255- // "DoNotRound" => DWM_WINDOW_CORNER_PREFERENCE.DoNotRound,
256- // "Round" => DWM_WINDOW_CORNER_PREFERENCE.Round,
257- // "RoundSmall" => DWM_WINDOW_CORNER_PREFERENCE.RoundSmall,
258- // _ => DWM_WINDOW_CORNER_PREFERENCE.Default,
259- // };
260-
261- // SetWindowCornerPreference(mainWindow, preference);
262- // }
263- // else
264- // {
265- // SetWindowCornerPreference(mainWindow, DWM_WINDOW_CORNER_PREFERENCE.Default);
266- // }
267- // }, DispatcherPriority.Normal);
268- //}
269-
270-
271236 /// <summary>
272237 /// Sets the blur for a window via SetWindowCompositionAttribute
273238 /// </summary>
@@ -287,14 +252,14 @@ public void SetBlurForWindow()
287252 if ( mainWindow == null )
288253 return ;
289254
290- // ✅ 테마가 블러를 지원하는지 확인
255+ // Check if the theme supports blur
291256 bool hasBlur = dict . Contains ( "ThemeBlurEnabled" ) && dict [ "ThemeBlurEnabled" ] is bool b && b ;
292257 if ( ! hasBlur )
293258 {
294- _settings . BackdropType = BackdropTypes . None ; // 🔥 블러가 없는 테마는 강제 None 처리
259+ _settings . BackdropType = BackdropTypes . None ;
295260 }
296261
297- // ✅ 설정된 BackdropType 확인
262+ // Check the configured BackdropType
298263 int backdropValue = _settings . BackdropType switch
299264 {
300265 BackdropTypes . Acrylic => 3 , // Acrylic
@@ -305,7 +270,7 @@ public void SetBlurForWindow()
305270
306271 if ( BlurEnabled && hasBlur )
307272 {
308- // ✅ Mica 또는 MicaAlt인 경우 배경을 투명하게 설정
273+ // If the BackdropType is Mica or MicaAlt, set the windowborderstyle's background to transparent
309274 if ( _settings . BackdropType == BackdropTypes . Mica || _settings . BackdropType == BackdropTypes . MicaAlt )
310275 {
311276 windowBorderStyle . Setters . Remove ( windowBorderStyle . Setters . OfType < Setter > ( ) . FirstOrDefault ( x => x . Property . Name == "Background" ) ) ;
@@ -328,7 +293,7 @@ public void SetBlurForWindow()
328293 }
329294 else
330295 {
331- // ✅ Blur가 비활성화되면 기본 스타일 적용
296+ // Apply default style when Blur is disabled
332297 Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_SYSTEMBACKDROP_TYPE , 0 ) ;
333298 ColorizeWindow ( GetSystemBG ( ) ) ;
334299 }
@@ -341,6 +306,7 @@ public void SetBlurForWindow()
341306
342307
343308 // Get Background Color from WindowBorderStyle when there not color for BG.
309+ // for theme has not "LightBG" or "DarkBG" case.
344310 private Color GetWindowBorderStyleBackground ( )
345311 {
346312 var Resources = GetThemeResourceDictionary ( _settings . Theme ) ;
@@ -389,7 +355,7 @@ private void ApplyPreviewBackground(Color? bgColor = null)
389355
390356 Application . Current . Dispatcher . Invoke ( ( ) =>
391357 {
392- // ✅ 기존 WindowBorderStyle을 복사
358+ // Copy the existing WindowBorderStyle
393359 var previewStyle = new Style ( typeof ( Border ) ) ;
394360 if ( Application . Current . Resources . Contains ( "WindowBorderStyle" ) )
395361 {
@@ -403,23 +369,19 @@ private void ApplyPreviewBackground(Color? bgColor = null)
403369 }
404370 }
405371
406- // ✅ 배경색 적용 (투명도 제거)
372+ // Apply background color (remove transparency in color)
373+ // WPF does not allow the use of an acrylic brush within the window's internal area,
374+ // so transparency effects are not applied to the preview.
407375 Color backgroundColor = Color . FromRgb ( bgColor . Value . R , bgColor . Value . G , bgColor . Value . B ) ;
408376 previewStyle . Setters . Add ( new Setter ( Border . BackgroundProperty , new SolidColorBrush ( backgroundColor ) ) ) ;
409377
410- // ✅ 블러 테마면 CornerRadius = 5, 비블러 테마면 기존 스타일 유지
378+ // The blur theme keeps the corner round fixed (applying DWM code to modify it causes rendering issues).
379+ // The non-blur theme retains the previously set WindowBorderStyle.
411380 if ( BlurEnabled )
412381 {
413382 previewStyle . Setters . Add ( new Setter ( Border . CornerRadiusProperty , new CornerRadius ( 5 ) ) ) ;
414383 previewStyle . Setters . Add ( new Setter ( Border . BorderThicknessProperty , new Thickness ( 1 ) ) ) ;
415384 }
416-
417- // ✅ 기타 설정 추가
418- //previewStyle.Setters.Add(new Setter(Border.BorderThicknessProperty, new Thickness(1)));
419- //previewStyle.Setters.Add(new Setter(Border.UseLayoutRoundingProperty, true));
420- //reviewStyle.Setters.Add(new Setter(Border.SnapsToDevicePixelsProperty, true));
421-
422- // ✅ 최종 적용
423385 Application . Current . Resources [ "PreviewWindowBorderStyle" ] = previewStyle ;
424386 } , DispatcherPriority . Render ) ;
425387 }
@@ -436,44 +398,42 @@ public void ColorizeWindow(string Mode)
436398 var mainWindow = Application . Current . MainWindow ;
437399 if ( mainWindow == null ) return ;
438400
439- // ✅ 블러 테마인지 확인
401+ // Check if the theme supports blur
440402 bool hasBlur = dict . Contains ( "ThemeBlurEnabled" ) && dict [ "ThemeBlurEnabled" ] is bool b && b ;
441403
442- // ✅ SystemBG 값 확인 (Auto, Light, Dark)
404+ // SystemBG value check (Auto, Light, Dark)
443405 string systemBG = dict . Contains ( "SystemBG" ) ? dict [ "SystemBG" ] as string : "Auto" ; // 기본값 Auto
444406
445- // ✅ 사용자의 ColorScheme 설정 확인
407+ // Check the user's ColorScheme setting
446408 string colorScheme = _settings . ColorScheme ;
447409
448- // ✅ 시스템의 다크 모드 설정 확인 ( AppsUseLightTheme 값 읽기 )
410+ // Check system dark mode setting (read AppsUseLightTheme value )
449411 int themeValue = ( int ) Registry . GetValue ( @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" , "AppsUseLightTheme" , 1 ) ;
450412 bool isSystemDark = themeValue == 0 ;
451413
452- // ✅ 최종적으로 사용할 다크 모드 여부 결정
414+ // Final decision on whether to use dark mode
453415 bool useDarkMode = false ;
454416
455417 if ( colorScheme == "Dark" || systemBG == "Dark" )
456418 {
457- useDarkMode = true ; // 사용자가 강제 다크 모드 선택
419+ useDarkMode = true ; // Dark
458420 }
459421 else if ( colorScheme == "Light" || systemBG == "Light" )
460422 {
461- useDarkMode = false ; // 사용자가 강제 라이트 모드 선택
423+ useDarkMode = false ; // Light
462424 }
463425 else if ( colorScheme == "System" || systemBG == "Auto" )
464426 {
465- useDarkMode = isSystemDark ; // 시스템 설정을 따름
427+ useDarkMode = isSystemDark ; // Auto
466428 }
467-
468- Debug . WriteLine ( $ "[ColorizeWindow] SystemBG: { systemBG } , ColorScheme: { colorScheme } , 시스템 다크 모드 여부: { isSystemDark } , 최종 적용: { useDarkMode } ") ;
469-
470- // ✅ DWM 다크 모드 설정 적용
429+
430+ // Apply DWM Dark Mode
471431 Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_USE_IMMERSIVE_DARK_MODE , useDarkMode ? 1 : 0 ) ;
472432
473433 Color LightBG ;
474434 Color DarkBG ;
475435
476- // LightBG 값 가져오기 (없으면 WindowBorderStyle의 배경색 사용 )
436+ // Retrieve LightBG value (fallback to WindowBorderStyle background color if not found )
477437 try
478438 {
479439 LightBG = dict . Contains ( "LightBG" ) ? ( Color ) dict [ "LightBG" ] : GetWindowBorderStyleBackground ( ) ;
@@ -483,7 +443,7 @@ public void ColorizeWindow(string Mode)
483443 LightBG = GetWindowBorderStyleBackground ( ) ;
484444 }
485445
486- // DarkBG 값 가져오기 (없으면 LightBG 사용 )
446+ // Retrieve DarkBG value (fallback to LightBG if not found )
487447 try
488448 {
489449 DarkBG = dict . Contains ( "DarkBG" ) ? ( Color ) dict [ "DarkBG" ] : LightBG ;
@@ -493,18 +453,17 @@ public void ColorizeWindow(string Mode)
493453 DarkBG = LightBG ;
494454 }
495455
496- // ✅ ColorScheme과 SystemBG에 맞춰서 배경색 선택
456+ // Select background color based on ColorScheme and SystemBG
497457 Color selectedBG = useDarkMode ? DarkBG : LightBG ;
498458 ApplyPreviewBackground ( selectedBG ) ;
499459
500- // ✅ Windows 10 테마(HasBlur=False)는 mainWindow.Background를 설정하지 않음
501460 if ( ! hasBlur )
502461 {
503462 mainWindow . Background = Brushes . Transparent ;
504463 }
505464 else
506465 {
507- // ✅ 블러 테마일 경우만 배경을 투명하게 설정
466+ // Only set the background to transparent if the theme supports blur
508467 if ( _settings . BackdropType == BackdropTypes . Mica || _settings . BackdropType == BackdropTypes . MicaAlt )
509468 {
510469 mainWindow . Background = new SolidColorBrush ( Color . FromArgb ( 1 , 0 , 0 , 0 ) ) ;
@@ -517,11 +476,6 @@ public void ColorizeWindow(string Mode)
517476 } , DispatcherPriority . Normal ) ;
518477 }
519478
520-
521-
522-
523-
524-
525479 public bool IsBlurTheme ( )
526480 {
527481 if ( Environment . OSVersion . Version >= new Version ( 6 , 2 ) )
@@ -785,7 +739,6 @@ private string GetThemePath(string themeName)
785739 public void AddDropShadowEffectToCurrentTheme ( )
786740 {
787741
788- //SetWindowCornerPreference("Default");
789742 var dict = GetCurrentResourceDictionary ( ) ;
790743
791744 var windowBorderStyle = dict [ "WindowBorderStyle" ] as Style ;
@@ -838,7 +791,6 @@ public void RemoveDropShadowEffectFromCurrentTheme()
838791 {
839792
840793 var dict = GetCurrentResourceDictionary ( ) ;
841- //mainWindow.WindowStyle = WindowStyle.None;
842794 var windowBorderStyle = dict [ "WindowBorderStyle" ] as Style ;
843795
844796 var effectSetter = windowBorderStyle . Setters . FirstOrDefault ( setterBase => setterBase is Setter setter && setter . Property == Border . EffectProperty ) as Setter ;
0 commit comments