Skip to content

Commit c68dc30

Browse files
Apply title coloring attributes to TopLevelWindow after handle recreation.
1 parent b83e93b commit c68dc30

File tree

1 file changed

+18
-1
lines changed
  • src/System.Windows.Forms/System/Windows/Forms

1 file changed

+18
-1
lines changed

src/System.Windows.Forms/System/Windows/Forms/Form.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3358,7 +3358,7 @@ protected override void CreateHandle()
33583358
}
33593359
}
33603360

3361-
// Deactivates active MDI child and temporarily marks it as unfocusable,
3361+
// Deactivates active MDI child and temporarily marks it as un-focusable,
33623362
// so that WM_SETFOCUS sent to MDIClient does not activate that child.
33633363
private void DeactivateMdiChild()
33643364
{
@@ -4897,6 +4897,23 @@ internal override unsafe void RecreateHandleCore()
48974897
Debug.Assert(result);
48984898
}
48994899

4900+
#pragma warning disable WFO5001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
4901+
if (TopLevel && IsHandleCreated)
4902+
{
4903+
FormCornerPreference formCornerPreference = Properties.GetValueOrDefault(s_propFormCornerPreference, FormCornerPreference.Default);
4904+
SetFormCornerPreferenceInternal(formCornerPreference);
4905+
4906+
Color colorValue = Properties.GetValueOrDefault(s_propFormCaptionTextColor, Color.Empty);
4907+
SetFormAttributeColorInternal(DWMWINDOWATTRIBUTE.DWMWA_TEXT_COLOR, colorValue);
4908+
4909+
colorValue = Properties.GetValueOrDefault(s_propFormCaptionBackColor, Color.Empty);
4910+
SetFormAttributeColorInternal(DWMWINDOWATTRIBUTE.DWMWA_CAPTION_COLOR, colorValue);
4911+
4912+
colorValue = Properties.GetValueOrDefault(s_propFormBorderColor, Color.Empty);
4913+
SetFormAttributeColorInternal(DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, colorValue);
4914+
}
4915+
#pragma warning restore WFO5001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
4916+
49004917
GC.KeepAlive(this);
49014918
}
49024919

0 commit comments

Comments
 (0)