@@ -279,13 +279,13 @@ public unsafe partial class Control :
279
279
private Font ? _scaledControlFont ;
280
280
private FontHandleWrapper ? _scaledFontWrapper ;
281
281
282
- // Contains a collection of calculated fonts for various Dpi values of the control in the PerMonV2 mode.
283
- private Dictionary < int , Font > ? _dpiFonts ;
284
-
285
282
// ContainerControls like 'PropertyGrid' scale their children when they resize.
286
283
// no explicit scaling of children required in such cases. They have specific logic.
287
284
internal bool _doNotScaleChildren ;
288
285
286
+ // Contains a collection of calculated fonts for various Dpi values of the control in the PerMonV2 mode.
287
+ private Dictionary < int , Font > ? _dpiFonts ;
288
+
289
289
// Flag to signify whether any child controls necessitate the calculation of AnchorsInfo,
290
290
// particularly in cases involving nested containers.
291
291
internal bool _childControlsNeedAnchorLayout ;
@@ -814,7 +814,6 @@ public virtual object? DataContext
814
814
{
815
815
Properties . RemoveValue ( s_dataContextProperty ) ;
816
816
OnDataContextChanged ( EventArgs . Empty ) ;
817
-
818
817
return ;
819
818
}
820
819
@@ -7333,18 +7332,6 @@ protected virtual void OnHandleCreated(EventArgs e)
7333
7332
SetWindowFont ( ) ;
7334
7333
}
7335
7334
7336
- #pragma warning disable WFO5001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
7337
- if ( Application . IsDarkModeEnabled && GetStyle ( ControlStyles . ApplyThemingImplicitly ) )
7338
- {
7339
- HRESULT result = PInvoke . SetWindowTheme (
7340
- hwnd : HWND ,
7341
- pszSubAppName : $ "{ DarkModeIdentifier } _{ ExplorerThemeIdentifier } ",
7342
- pszSubIdList : null ) ;
7343
-
7344
- Debug . Assert ( result . Succeeded , "SetWindowTheme failed with HRESULT: " + result ) ;
7345
- }
7346
- #pragma warning restore WFO5001
7347
-
7348
7335
HandleHighDpi ( ) ;
7349
7336
7350
7337
// Restore drag drop status. Ole Initialize happens when the ThreadContext in Application is created.
@@ -10401,9 +10388,7 @@ protected virtual void SetVisibleCore(bool value)
10401
10388
PrepareDarkMode ( HWND , Application . IsDarkModeEnabled ) ;
10402
10389
}
10403
10390
10404
- PInvoke . ShowWindow ( HWND , value
10405
- ? ShowParams
10406
- : SHOW_WINDOW_CMD . SW_HIDE ) ;
10391
+ PInvoke . ShowWindow ( HWND , value ? ShowParams : SHOW_WINDOW_CMD . SW_HIDE ) ;
10407
10392
}
10408
10393
}
10409
10394
#pragma warning restore WFO5001
@@ -10415,7 +10400,6 @@ protected virtual void SetVisibleCore(bool value)
10415
10400
10416
10401
SetState ( States . Visible , value ) ;
10417
10402
fireChange = true ;
10418
-
10419
10403
try
10420
10404
{
10421
10405
if ( value )
@@ -10424,19 +10408,14 @@ protected virtual void SetVisibleCore(bool value)
10424
10408
}
10425
10409
10426
10410
PInvoke . SetWindowPos (
10427
- hWnd : this ,
10428
- hWndInsertAfter : HWND . Null ,
10429
- X : 0 ,
10430
- Y : 0 ,
10431
- cx : 0 ,
10432
- cy : 0 ,
10433
- uFlags : SET_WINDOW_POS_FLAGS . SWP_NOSIZE
10411
+ this ,
10412
+ HWND . Null ,
10413
+ 0 , 0 , 0 , 0 ,
10414
+ SET_WINDOW_POS_FLAGS . SWP_NOSIZE
10434
10415
| SET_WINDOW_POS_FLAGS . SWP_NOMOVE
10435
10416
| SET_WINDOW_POS_FLAGS . SWP_NOZORDER
10436
10417
| SET_WINDOW_POS_FLAGS . SWP_NOACTIVATE
10437
- | ( value
10438
- ? SET_WINDOW_POS_FLAGS . SWP_SHOWWINDOW
10439
- : SET_WINDOW_POS_FLAGS . SWP_HIDEWINDOW ) ) ;
10418
+ | ( value ? SET_WINDOW_POS_FLAGS . SWP_SHOWWINDOW : SET_WINDOW_POS_FLAGS . SWP_HIDEWINDOW ) ) ;
10440
10419
}
10441
10420
catch
10442
10421
{
@@ -10490,30 +10469,27 @@ protected virtual void SetVisibleCore(bool value)
10490
10469
if ( IsHandleCreated )
10491
10470
{
10492
10471
PInvoke . SetWindowPos (
10493
- hWnd : this ,
10494
- hWndInsertAfter : HWND . HWND_TOP ,
10495
- X : 0 ,
10496
- Y : 0 ,
10497
- cx : 0 ,
10498
- cy : 0 ,
10499
- uFlags : SET_WINDOW_POS_FLAGS . SWP_NOSIZE
10472
+ this ,
10473
+ HWND . HWND_TOP ,
10474
+ 0 , 0 , 0 , 0 ,
10475
+ SET_WINDOW_POS_FLAGS . SWP_NOSIZE
10500
10476
| SET_WINDOW_POS_FLAGS . SWP_NOMOVE
10501
10477
| SET_WINDOW_POS_FLAGS . SWP_NOZORDER
10502
10478
| SET_WINDOW_POS_FLAGS . SWP_NOACTIVATE
10503
10479
| ( value ? SET_WINDOW_POS_FLAGS . SWP_SHOWWINDOW : SET_WINDOW_POS_FLAGS . SWP_HIDEWINDOW ) ) ;
10504
10480
}
10505
10481
}
10506
- }
10507
10482
10508
- private static unsafe void PrepareDarkMode ( HWND hwnd , bool darkModeEnabled )
10509
- {
10510
- BOOL value = darkModeEnabled ;
10483
+ static unsafe void PrepareDarkMode ( HWND hwnd , bool darkModeEnabled )
10484
+ {
10485
+ BOOL value = darkModeEnabled ;
10511
10486
10512
- PInvoke . DwmSetWindowAttribute (
10513
- hwnd ,
10514
- DWMWINDOWATTRIBUTE . DWMWA_USE_IMMERSIVE_DARK_MODE ,
10515
- & value ,
10516
- ( uint ) sizeof ( BOOL ) ) . AssertSuccess ( ) ;
10487
+ PInvoke . DwmSetWindowAttribute (
10488
+ hwnd ,
10489
+ DWMWINDOWATTRIBUTE . DWMWA_USE_IMMERSIVE_DARK_MODE ,
10490
+ & value ,
10491
+ ( uint ) sizeof ( BOOL ) ) . AssertSuccess ( ) ;
10492
+ }
10517
10493
}
10518
10494
10519
10495
/// <summary>
0 commit comments