Skip to content

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

Merged
LeafShi1 merged 1 commit into
mainfrom
Fix_14641_NumericUpDown_color_issue
Jul 1, 2026
Merged

LeafShi1 merged 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.

@LeafShi1
LeafShi1 requested a review from Shyam-Gupta June 18, 2026 01:01

@Shyam-Gupta Shyam-Gupta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@Shyam-Gupta

Copy link
Copy Markdown
Member

FYI: @KlausLoeffelmann

@LeafShi1 LeafShi1 added this to the 11.0-preview7 milestone Jul 1, 2026
@LeafShi1
LeafShi1 merged commit 6cb81ba into main Jul 1, 2026
11 checks passed
@LeafShi1
LeafShi1 deleted the Fix_14641_NumericUpDown_color_issue branch July 1, 2026 02:49
@dotnet-policy-service dotnet-policy-service Bot removed the waiting-review This item is waiting on review by one or more members of team label Jul 1, 2026
@LeafShi1 LeafShi1 removed this from the 11.0-preview7 milestone Jul 1, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 7, 2026
@LeafShi1 LeafShi1 added the releasenotes-candidate This issue is a candidate to be mentioned in the release notes, if the respective PR fixed it. label Jul 15, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

releasenotes-candidate This issue is a candidate to be mentioned in the release notes, if the respective PR fixed it.

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

4 participants