Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/System.Windows.Forms/System/Windows/Forms/Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ public unsafe partial class Control :
internal const string ExplorerThemeIdentifier = "Explorer";
internal const string ItemsViewThemeIdentifier = "ItemsView";
internal const string ComboBoxButtonThemeIdentifier = "CFD";
internal const string BannerContainerThemeIdentifier = "FileExplorerBannerContainer";
internal const string ComboboxClassIdentifier = "COMBOBOX";

private const short PaintLayerBackground = 1;
private const short PaintLayerForeground = 2;
Expand Down Expand Up @@ -9207,9 +9209,12 @@ internal virtual void RecreateHandleCore()

bool focused = ContainsFocus;

Debug.WriteLineIf(CoreSwitches.PerfTrack.Enabled, $"RecreateHandle: {GetType().FullName} [Text={Text}]");
Debug.WriteLineIf(
CoreSwitches.PerfTrack.Enabled,
$"RecreateHandle: {GetType().FullName} [Text={Text}]");

bool created = GetState(States.Created);

if (GetState(States.TrackingMouseEvent))
{
SetState(States.MouseEnterPending, true);
Expand All @@ -9232,9 +9237,11 @@ internal virtual void RecreateHandleCore()
if (ChildControls is { } children && children.Count > 0)
{
controlSnapshot = new Control[children.Count];

for (int i = 0; i < children.Count; i++)
{
Control childControl = children[i];

if (childControl is not null && childControl.IsHandleCreated)
{
// SetParent to parking window
Expand Down Expand Up @@ -9294,6 +9301,7 @@ internal virtual void RecreateHandleCore()
for (int i = 0; i < controlSnapshot.Length; i++)
{
Control? childControl = controlSnapshot[i];

if (childControl is not null && childControl.IsHandleCreated)
{
// Re-parent the control.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ public static class ComboBoxRenderer
// Make this per-thread, so that different threads can safely use these methods.
[ThreadStatic]
private static VisualStyleRenderer? t_visualStyleRenderer;
private static readonly VisualStyleElement s_comboBoxElement = VisualStyleElement.ComboBox.DropDownButton.Normal;

#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.

private static readonly VisualStyleElement s_comboBoxElement = Application.IsDarkModeEnabled
? VisualStyleElement.CreateElement($"{Control.DarkModeIdentifier}_{Control.ComboBoxButtonThemeIdentifier}::{Control.ComboboxClassIdentifier}", 1, 1)
: VisualStyleElement.ComboBox.DropDownButton.Normal;

#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.

private static readonly VisualStyleElement s_textBoxElement = VisualStyleElement.TextBox.TextEdit.Normal;

/// <summary>
Expand Down
Loading
Loading