Skip to content

Commit 07ad246

Browse files
Fix merge issues.
1 parent aebb726 commit 07ad246

File tree

1 file changed

+22
-46
lines changed
  • src/System.Windows.Forms/System/Windows/Forms

1 file changed

+22
-46
lines changed

src/System.Windows.Forms/System/Windows/Forms/Control.cs

Lines changed: 22 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ public unsafe partial class Control :
279279
private Font? _scaledControlFont;
280280
private FontHandleWrapper? _scaledFontWrapper;
281281

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-
285282
// ContainerControls like 'PropertyGrid' scale their children when they resize.
286283
// no explicit scaling of children required in such cases. They have specific logic.
287284
internal bool _doNotScaleChildren;
288285

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+
289289
// Flag to signify whether any child controls necessitate the calculation of AnchorsInfo,
290290
// particularly in cases involving nested containers.
291291
internal bool _childControlsNeedAnchorLayout;
@@ -814,7 +814,6 @@ public virtual object? DataContext
814814
{
815815
Properties.RemoveValue(s_dataContextProperty);
816816
OnDataContextChanged(EventArgs.Empty);
817-
818817
return;
819818
}
820819

@@ -7333,18 +7332,6 @@ protected virtual void OnHandleCreated(EventArgs e)
73337332
SetWindowFont();
73347333
}
73357334

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-
73487335
HandleHighDpi();
73497336

73507337
// Restore drag drop status. Ole Initialize happens when the ThreadContext in Application is created.
@@ -10401,9 +10388,7 @@ protected virtual void SetVisibleCore(bool value)
1040110388
PrepareDarkMode(HWND, Application.IsDarkModeEnabled);
1040210389
}
1040310390

10404-
PInvoke.ShowWindow(HWND, value
10405-
? ShowParams
10406-
: SHOW_WINDOW_CMD.SW_HIDE);
10391+
PInvoke.ShowWindow(HWND, value ? ShowParams : SHOW_WINDOW_CMD.SW_HIDE);
1040710392
}
1040810393
}
1040910394
#pragma warning restore WFO5001
@@ -10415,7 +10400,6 @@ protected virtual void SetVisibleCore(bool value)
1041510400

1041610401
SetState(States.Visible, value);
1041710402
fireChange = true;
10418-
1041910403
try
1042010404
{
1042110405
if (value)
@@ -10424,19 +10408,14 @@ protected virtual void SetVisibleCore(bool value)
1042410408
}
1042510409

1042610410
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
1043410415
| SET_WINDOW_POS_FLAGS.SWP_NOMOVE
1043510416
| SET_WINDOW_POS_FLAGS.SWP_NOZORDER
1043610417
| 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));
1044010419
}
1044110420
catch
1044210421
{
@@ -10490,30 +10469,27 @@ protected virtual void SetVisibleCore(bool value)
1049010469
if (IsHandleCreated)
1049110470
{
1049210471
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
1050010476
| SET_WINDOW_POS_FLAGS.SWP_NOMOVE
1050110477
| SET_WINDOW_POS_FLAGS.SWP_NOZORDER
1050210478
| SET_WINDOW_POS_FLAGS.SWP_NOACTIVATE
1050310479
| (value ? SET_WINDOW_POS_FLAGS.SWP_SHOWWINDOW : SET_WINDOW_POS_FLAGS.SWP_HIDEWINDOW));
1050410480
}
1050510481
}
10506-
}
1050710482

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;
1051110486

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+
}
1051710493
}
1051810494

1051910495
/// <summary>

0 commit comments

Comments
 (0)