Skip to content

Conversation

Epica3055
Copy link
Member

@Epica3055 Epica3055 commented Aug 8, 2025

Fixes #13777

Proposed changes

  • add hover parameter

Screenshots

Before

Issue_13777_before

After

Issue_13777_after2

Test methodology

  • manual

…s is not visible in DomainUpDown/NumericUpDown when mouse-over or click them
@Epica3055 Epica3055 requested a review from a team as a code owner August 8, 2025 08:20
@github-actions github-actions bot added the area-DarkMode Issues relating to Dark Mode feature label Aug 8, 2025
Copy link

codecov bot commented Aug 8, 2025

Codecov Report

❌ Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.08929%. Comparing base (1a08ff2) to head (59daf38).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13795         +/-   ##
===================================================
+ Coverage   77.08387%   77.08929%   +0.00542%     
===================================================
  Files           3271        3271                 
  Lines         644354      644358          +4     
  Branches       47658       47658                 
===================================================
+ Hits          496693      496731         +38     
+ Misses        143981      143957         -24     
+ Partials        3680        3670         -10     
Flag Coverage Δ
Debug 77.08929% <0.00000%> (+0.00542%) ⬆️
integration 18.99907% <0.00000%> (+0.00844%) ⬆️
production 51.90102% <0.00000%> (+0.01248%) ⬆️
test 97.41609% <ø> (ø)
unit 49.30656% <0.00000%> (+0.00591%) ⬆️

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.

@LeafShi1 LeafShi1 requested a review from Copilot August 12, 2025 01:32
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 the dark mode visibility issue for the divider line between Up and Down buttons in DomainUpDown/NumericUpDown controls when hovering or clicking them. The fix addresses the problem where the divider line disappears during mouse interactions in dark mode.

  • Replaces legacy ControlPaint.DrawScrollButton with modern DrawModernControlButton API
  • Adds hover state detection using _mouseOver parameter to properly handle button states
  • Uses ModernControlButtonStyle.SingleBorder flag to ensure consistent border rendering

@@ -4,6 +4,7 @@
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms.VisualStyles;
using static System.Windows.Forms.ControlPaint;
Copy link
Preview

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

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

[nitpick] Adding a static using for ControlPaint while only using one method (DrawModernControlButton) may reduce code clarity. Consider using the fully qualified name or ensure multiple ControlPaint methods are used to justify the static import.

Copilot uses AI. Check for mistakes.

? ButtonState.Pushed
: (Enabled ? ButtonState.Normal : ButtonState.Inactive));
? ModernControlButtonState.Pressed
: (Enabled ? (_mouseOver == ButtonID.Up ? ModernControlButtonState.Hover : ModernControlButtonState.Normal)
Copy link
Preview

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

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

The nested ternary operator creates complex logic that's hard to read. Consider using a switch expression or extracting this logic into a helper method to improve readability.

Copilot uses AI. Check for mistakes.

? ButtonState.Pushed
: (Enabled ? ButtonState.Normal : ButtonState.Inactive));
? ModernControlButtonState.Pressed
: (Enabled ? (_mouseOver == ButtonID.Down ? ModernControlButtonState.Hover : ModernControlButtonState.Normal)
Copy link
Preview

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

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

This duplicates the same complex ternary logic from the Up button. Extract this state determination logic into a helper method to eliminate duplication and improve maintainability.

Copilot uses AI. Check for mistakes.

Copy link
Member

@KlausLoeffelmann KlausLoeffelmann left a comment

Choose a reason for hiding this comment

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

Very good catch!!
I have NO idea, why I did not switch to the Modern button renderer once I implemented it?!

If you have some time, please check the remaining modes a button can have (hover, pressed, etc.), and check, if I forgot to switch to the modern renderer also at other places.

Feel free then, to ping me to fix that or - if you like - to just push a follow-up PR!

Thanks a lot!!

@Epica3055 Epica3055 merged commit ed08174 into dotnet:main Aug 13, 2025
8 checks passed
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: Divider line between Up and Down buttons is not visible in DomainUpDown/NumericUpDown when mouse-over or click them
2 participants