-
Notifications
You must be signed in to change notification settings - Fork 991
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
Dark mode/Visual Styles (VB Only) fix #11907
Conversation
bc714e6
to
5a49ec5
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11907 +/- ##
===================================================
- Coverage 75.01833% 75.01587% -0.00246%
===================================================
Files 3047 3047
Lines 631591 631621 +30
Branches 46764 46770 +6
===================================================
+ Hits 473809 473816 +7
- Misses 154420 154440 +20
- Partials 3362 3365 +3
Flags with carried forward coverage won't be shown. Click here to find out more. |
@@ -2428,14 +2440,16 @@ private unsafe void SetFormCornerPreferenceInternal(FormCornerPreference cornerP | |||
[Experimental(DiagnosticIDs.ExperimentalDarkMode, UrlFormat = DiagnosticIDs.UrlFormat)] |
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.
@KlausLoeffelmann
I see this function need to be in some Controls not only in Form So that we can benefit from it to the maximum extent
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 function can be applied to all popup
this function can be applied to all popup Windows
like Menus ,Tooltips, ...........
Non round example
2024-08-18_04-42-29.mp4
Round example
2024-08-18_04-51-13.mp4
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.
Wait, what do you mean "this function can be applied..."
When I see the video clips, I see I few things I have questions about. Like the dark Tab Control. How is that implemented/tuned?
The rounded Buttons look cool (and also the tool tips and other elements I see).
Is this done by custom rendering or did you apply the same Win32 API to it?
Keep in mind:
VisualStylesMode
was a concept I came up with primarily driven by accessibility, actually somewhat late in the development cycle (around end of April/begin of May I think I only had the first prototype which I did as a proof of concept first in my spare time) to complement the dark mode feature in terms of contrast issues we saw, and in general to address an upcoming regulatory issue where we need bigger "real estate" for clicking "landing spots" for controls. So, the teeny-tiny Up-Down-Buttons from NumericUpDown
or DomainUpDown
are very extreme examples for that. They are just an accessibility nightmare IMO. The non-styleble MonthCalendar
with its tiny date numbers is another example. And TextBox
(TextBoxBase
) itself is yet another one, because we cannot adjust its Padding
: In 96 dpi without a border, it got only a height of 16 pixels, if I remember correctly. And that's just not good enough in the context of HighDPI-Monitors and mindful accessibility. So - "styling" improvements should have those things in mind. The animated CheckBox
looks arguably cooler than the old one as a side effect, alright: But: It has that bigger landing spot and is better recognizable. We need to have a valid argument in that regard to think about improvements in style or real-estate.
Everything that goes beyond that becomes Theming, and that's where we (WinForms Team) all agreed, is a line we cannot cross. Our third parties have those things already in place, and they do an extremely good job with that.
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.
Wait, what do you mean "this function can be applied..." When I see the video clips, I see I few things I have questions about. Like the dark Tab Control. How is that implemented/tuned?
this is implemented by paint on Wm_ Paint but there is multiple solution for the Tab Control see #11953.
The rounded Buttons look cool (and also the tool tips and other elements I see). Is this done by custom rendering or did you apply the same Win32 API to it?
The tool tips and pop up menus use DWM_WINDOW_CORNER_PREFERENCE and any Window has WS_POPUP can use it
#pragma warning disable WFO5001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
if (SystemInformation.HighContrast)
{
PInvoke.SetWindowTheme(HWND, string.Empty, string.Empty);
}
else if (Application.IsDarkModeEnabled && !_isBalloon)
{
DWM_WINDOW_CORNER_PREFERENCE round = DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND;
PInvoke.DwmSetWindowAttribute(HWND, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, &round, sizeof(DWM_WINDOW_CORNER_PREFERENCE));
PInvoke.SendMessage(HWND, PInvoke.TTM_SETWINDOWTHEME, default, "DarkMode_Explorer");
}
#pragma warning restore WFO5001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
}
the remains elements is use Uxtheme Win32 API and its Documented.
Everything that goes beyond that becomes Theming, and that's where we (WinForms Team) all agreed, is a line we cannot cross. Our third parties have those things already in place, and they do an extremely good job with that.
may me not one line but multiple lines
7399164
to
6c0a092
Compare
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.
LGTM
Fixes issue where in Visual Basic the "classic" Visual Styles are no longer get set. (This is a breaking change, since in VB the classic Visual Styles are no longer set, even if they are enabled in the VS App Framework Property Pages.)
NOTE: This has nothing to do with the originally considered
VisualStylesMode
Experimental feature in the dark mode context.Fixes issue where instead of the
FormCaptionTextColorChanged
event theFormCaptionBackColorChanged
event is raised (This is not a breaking change, since these are completely new events.)Fixes #11898.
Fixes #11897.
Fixes #11895.
Fixes #11910.