Skip to content

Conversation

LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented Sep 24, 2025

Fixes #13897

Proposed changes

  • Add MouseDownBackColor and MouseOverBackColor for Flat button in DarkMode
  • Add borderSize and borderColor drawing logic to Flat button

Customer Impact

  • The FlatAppearance property can be set normally in DarkMode

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

FlatAppearance settings are ignored

button3.BackColor = Color.Transparent;
button3.FlatAppearance.BorderSize = 5;
button3.FlatAppearance.BorderColor = Color.Yellow;
button3.FlatAppearance.MouseOverBackColor = Color.Purple;
button3.FlatAppearance.MouseDownBackColor = Color.Red;
beforeChange.mp4

After

All of the FlatAppearance properties work well

AfterChanges.mp4

Test methodology

  • Manually

Test environment(s)

  • .net 10.0.0-rc.1.25467.108
Microsoft Reviewers: Open in CodeFlow

@github-actions github-actions bot added the area-DarkMode Issues relating to Dark Mode feature label Sep 24, 2025
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

❌ Patch coverage is 0% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.14583%. Comparing base (5a9fb88) to head (e58f2ab).

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13898         +/-   ##
===================================================
- Coverage   77.15021%   77.14583%   -0.00438%     
===================================================
  Files           3274        3274                 
  Lines         645043      645064         +21     
  Branches       47701       47705          +4     
===================================================
- Hits          497652      497640         -12     
- Misses        143717      143742         +25     
- Partials        3674        3682          +8     
Flag Coverage Δ
Debug 77.14583% <0.00000%> (-0.00438%) ⬇️
integration 18.98383% <0.00000%> (-0.01568%) ⬇️
production 52.00495% <0.00000%> (-0.00796%) ⬇️
test 97.41286% <ø> (ø)
unit 49.42222% <0.00000%> (+0.00056%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dotnet-policy-service dotnet-policy-service bot added the draft draft PR label Sep 24, 2025
@LeafShi1 LeafShi1 removed the draft draft PR label Sep 25, 2025
@LeafShi1 LeafShi1 marked this pull request as ready for review September 25, 2025 03:17
@LeafShi1 LeafShi1 requested a review from a team as a code owner September 25, 2025 03:17
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes button border and color issues for buttons with FlatStyle = Flat by implementing proper support for FlatAppearance properties in dark mode. The changes ensure that MouseDownBackColor, MouseOverBackColor, BorderSize, and BorderColor properties are respected when rendering flat buttons in dark mode.

Key changes:

  • Extended button renderer interfaces and implementations to support border size and color parameters
  • Added logic to respect FlatAppearance MouseDownBackColor and MouseOverBackColor properties
  • Updated all dark mode button renderers to handle the new border parameters

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ButtonDarkModeAdapter.cs Added logic to use FlatAppearance MouseDownBackColor and MouseOverBackColor, and pass BorderSize/BorderColor to renderers
IButtonRenderer.cs Extended interface to include borderSize and borderColor parameters in method signatures
ButtonDarkModeRendererBase.cs Updated base class to support new border parameters and added virtual DrawButtonBorder method
FlatButtonDarkModeRenderer.cs Implemented proper border handling using FlatAppearance properties and simplified border drawing
SystemButtonDarkModeRenderer.cs Updated method signature to match interface changes
PopupButtonDarkModeRenderer.cs Updated method signature to match interface changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-DarkMode Issues relating to Dark Mode feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dark Mode] Button with FlatStyle = Flat: FlatAppearance properties not working in Dark Mode
1 participant