Skip to content

Fix NumericUpDown button rendering regression when visual styles are disabled#14643

Open
LeafShi1 wants to merge 1 commit into
mainfrom
Fix_14641_NumericUpDown_color_issue
Open

Fix NumericUpDown button rendering regression when visual styles are disabled#14643
LeafShi1 wants to merge 1 commit into
mainfrom
Fix_14641_NumericUpDown_color_issue

Conversation

@LeafShi1

@LeafShi1 LeafShi1 commented Jun 12, 2026

Copy link
Copy Markdown
Member

Fixes #14641

Root Cause

The non-visual-style path was unintentionally routed to the modern button renderer by this condition:
Application.IsDarkModeEnabled || !Application.RenderWithVisualStyles

That behavior came from PR #13747.

Proposed changes

In UpDownBase.UpDownButtons.cs:

  • Use modern renderer only when dark mode is enabled.
  • Keep themed renderer path when visual styles are enabled.
  • Restore classic DrawScrollButton fallback when visual styles are disabled.

Customer Impact

  • After fix, the up/down buttons of the NumericUpDown control are normal gray color.

Regression?

  • Yes

Risk

  • Minimal

Screenshots

Before

The up/down buttons of the NumericUpDown control are black.
image

After

The up/down buttons of the NumericUpDown control are gray color.
image

Test methodology

  • Manually

Test environment(s)

  • .net 11.0.0-preview.6.26311.113
Microsoft Reviewers: Open in CodeFlow

@LeafShi1 LeafShi1 requested a review from a team as a code owner June 12, 2026 07:33
@LeafShi1 LeafShi1 added the waiting-review This item is waiting on review by one or more members of team label Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a rendering regression in NumericUpDown/UpDownBase where the up/down buttons were drawn using the modern (dark-mode) renderer even when visual styles were disabled, resulting in incorrect (black) buttons in classic mode.

Changes:

  • Restricts the modern control-button renderer to dark mode only (Application.IsDarkModeEnabled).
  • Uses VisualStyleRenderer only when visual styles are enabled (Application.RenderWithVisualStyles).
  • Restores classic ControlPaint.DrawScrollButton rendering when visual styles are disabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-review This item is waiting on review by one or more members of team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows Forms NumericUpDown control up/down buttons black when ApplicationVisualStyles is false

2 participants