-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix #13777 : Dark Mode: Divider line between Up and Down buttons is not visible in DomainUpDown/NumericUpDown when mouse-over or click them #13795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…s is not visible in DomainUpDown/NumericUpDown when mouse-over or click them
Codecov Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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 modernDrawModernControlButton
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; |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this 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!!
Fixes #13777
Proposed changes
Screenshots
Before
After
Test methodology