Skip to content

Commit 687601b

Browse files
Remove Experimental attribute for dark mode (#13810)
Fixes #13805 * Removes the ExperimentalAttribute for all Dark Mode (SetColorMode) related APIs. * Updates the docs for `Application.SetColorMode` to reflect latest developments. * Removes #Pragma 5001 ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/13810)
2 parents 82fc52e + 96cd8b1 commit 687601b

File tree

52 files changed

+122
-231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+122
-231
lines changed

src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/ApplyApplicationDefaultsEventArgs.vb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ Namespace Microsoft.VisualBasic.ApplicationServices
1717
Public Class ApplyApplicationDefaultsEventArgs
1818
Inherits EventArgs
1919

20-
#Disable Warning WFO5001
21-
2220
Friend Sub New(minimumSplashScreenDisplayTime As Integer,
2321
highDpiMode As HighDpiMode,
2422
colorMode As SystemColorMode)
@@ -28,13 +26,10 @@ Namespace Microsoft.VisualBasic.ApplicationServices
2826
Me.ColorMode = colorMode
2927
End Sub
3028

31-
#Enable Warning WFO5001
32-
3329
''' <summary>
3430
''' Setting this property inside the event handler determines the
3531
''' <see cref="Application.ColorMode"/> for the application.
3632
''' </summary>
37-
<Experimental(DiagnosticIDs.ExperimentalDarkMode, UrlFormat:=DiagnosticIDs.UrlFormat)>
3833
Public Property ColorMode As SystemColorMode
3934

4035
''' <summary>

src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,10 @@ Namespace Microsoft.VisualBasic.ApplicationServices
6565

6666
Private _appSynchronizationContext As SynchronizationContext
6767

68-
#Disable Warning WFO5001 ' Type is for evaluation purposes only and is subject to change or removal in future updates.
69-
7068
' The ColorMode (Classic/Light, System, Dark) the user assigned to the ApplyApplicationsDefault event.
7169
' Note: We aim to expose this to the App Designer in later runtime/VS versions.
7270
Private _colorMode As SystemColorMode = SystemColorMode.Classic
7371

74-
#Enable Warning WFO5001
75-
7672
' We only need to show the splash screen once.
7773
' Protect the user from himself if they are overriding our app model.
7874
Private _didSplashScreen As Boolean
@@ -194,7 +190,6 @@ Namespace Microsoft.VisualBasic.ApplicationServices
194190
''' <value>
195191
''' The <see cref="SystemColorMode"/> that the application is running in.
196192
''' </value>
197-
<Experimental(DiagnosticIDs.ExperimentalDarkMode, UrlFormat:=DiagnosticIDs.UrlFormat)>
198193
<EditorBrowsable(EditorBrowsableState.Never)>
199194
Protected Property ColorMode As SystemColorMode
200195
Get
@@ -748,15 +743,13 @@ Namespace Microsoft.VisualBasic.ApplicationServices
748743
' Once all this is done, we give the User another chance to change the value by code through
749744
' the ApplyDefaults event.
750745
' Note: Overriding MinimumSplashScreenDisplayTime needs still to keep working!
751-
#Disable Warning WFO5001 ' Type is for evaluation purposes only and is subject to change or removal in future updates.
752746
Dim applicationDefaultsEventArgs As New ApplyApplicationDefaultsEventArgs(
753747
MinimumSplashScreenDisplayTime,
754748
HighDpiMode,
755749
ColorMode) With
756750
{
757751
.MinimumSplashScreenDisplayTime = MinimumSplashScreenDisplayTime
758752
}
759-
#Enable Warning WFO5001
760753

761754
RaiseEvent ApplyApplicationDefaults(Me, applicationDefaultsEventArgs)
762755

@@ -771,9 +764,6 @@ Namespace Microsoft.VisualBasic.ApplicationServices
771764
AsyncOperationManager.SynchronizationContext = New WindowsFormsSynchronizationContext()
772765

773766
_highDpiMode = applicationDefaultsEventArgs.HighDpiMode
774-
775-
#Disable Warning WFO5001 ' Type is for evaluation purposes only and is subject to change or removal in future updates.
776-
777767
_colorMode = applicationDefaultsEventArgs.ColorMode
778768

779769
' Then, it's applying what we got back as HighDpiMode.
@@ -782,6 +772,7 @@ Namespace Microsoft.VisualBasic.ApplicationServices
782772
If dpiSetResult Then
783773
_highDpiMode = Application.HighDpiMode
784774
End If
775+
785776
Debug.Assert(dpiSetResult, "We could not set the HighDpiMode.")
786777

787778
' Now, let's set VisualStyles and ColorMode:
@@ -791,8 +782,6 @@ Namespace Microsoft.VisualBasic.ApplicationServices
791782

792783
Application.SetColorMode(_colorMode)
793784

794-
#Enable Warning WFO5001
795-
796785
' We'll handle "/nosplash" for you.
797786
If Not (commandLineArgs.Contains("/nosplash") OrElse Me.CommandLineArgs.Contains("-nosplash")) Then
798787
ShowSplashScreen()

src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/WindowsFormsApplicationBaseTests.vb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ Namespace Microsoft.VisualBasic.Forms.Tests
1717
Public Sub Properties()
1818
UseCompatibleTextRendering.Should.BeFalse()
1919

20-
#Disable Warning WFO5001 ' Type is for evaluation purposes only and is subject to change or removal in future updates.
2120
ColorMode.Should.Be(SystemColorMode.Classic)
2221
ColorMode = SystemColorMode.Dark
2322
ColorMode.Should.Be(SystemColorMode.Dark)
24-
#Enable Warning WFO5001
2523

2624
EnableVisualStyles.Should.Be(False)
2725
EnableVisualStyles = True

src/System.Windows.Forms/PublicAPI.Shipped.txt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
11
#nullable enable
2-
[WFO5001]static System.Windows.Forms.Application.SetColorMode(System.Windows.Forms.SystemColorMode systemColorMode) -> void
3-
[WFO5001]System.Windows.Forms.ControlStyles.ApplyThemingImplicitly = 524288 -> System.Windows.Forms.ControlStyles
4-
[WFO5001]System.Windows.Forms.Form.FormBorderColorChanged -> System.EventHandler?
5-
[WFO5001]System.Windows.Forms.Form.FormCaptionBackColorChanged -> System.EventHandler?
6-
[WFO5001]System.Windows.Forms.Form.FormCaptionTextColorChanged -> System.EventHandler?
7-
[WFO5001]System.Windows.Forms.Form.FormCornerPreferenceChanged -> System.EventHandler?
8-
[WFO5001]System.Windows.Forms.FormCornerPreference
9-
[WFO5001]System.Windows.Forms.FormCornerPreference.Default = 0 -> System.Windows.Forms.FormCornerPreference
10-
[WFO5001]System.Windows.Forms.FormCornerPreference.DoNotRound = 1 -> System.Windows.Forms.FormCornerPreference
11-
[WFO5001]System.Windows.Forms.FormCornerPreference.Round = 2 -> System.Windows.Forms.FormCornerPreference
12-
[WFO5001]System.Windows.Forms.FormCornerPreference.RoundSmall = 3 -> System.Windows.Forms.FormCornerPreference
13-
[WFO5001]System.Windows.Forms.SystemColorMode
14-
[WFO5001]System.Windows.Forms.SystemColorMode.Classic = 0 -> System.Windows.Forms.SystemColorMode
15-
[WFO5001]System.Windows.Forms.SystemColorMode.Dark = 2 -> System.Windows.Forms.SystemColorMode
16-
[WFO5001]System.Windows.Forms.SystemColorMode.System = 1 -> System.Windows.Forms.SystemColorMode
17-
[WFO5001]virtual System.Windows.Forms.Form.OnFormBorderColorChanged(System.EventArgs! e) -> void
18-
[WFO5001]virtual System.Windows.Forms.Form.OnFormCaptionBackColorChanged(System.EventArgs! e) -> void
19-
[WFO5001]virtual System.Windows.Forms.Form.OnFormCaptionTextColorChanged(System.EventArgs! e) -> void
20-
[WFO5001]virtual System.Windows.Forms.Form.OnFormCornerPreferenceChanged(System.EventArgs! e) -> void
212
[WFO5003]System.Windows.Forms.IAsyncDropTarget
223
[WFO5003]System.Windows.Forms.IAsyncDropTarget.OnAsyncDragDrop(System.Windows.Forms.DragEventArgs! e) -> void
234
~abstract System.Windows.Forms.DataGridColumnStyle.Commit(System.Windows.Forms.CurrencyManager dataSource, int rowNum) -> bool
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
1+
static System.Windows.Forms.Application.SetColorMode(System.Windows.Forms.SystemColorMode systemColorMode) -> void
12
static System.Windows.Forms.TaskDialog.ShowDialogAsync(nint hwndOwner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
23
static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
34
static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterScreen) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
5+
System.Windows.Forms.ControlStyles.ApplyThemingImplicitly = 524288 -> System.Windows.Forms.ControlStyles
6+
System.Windows.Forms.Form.FormBorderColorChanged -> System.EventHandler?
7+
System.Windows.Forms.Form.FormCaptionBackColorChanged -> System.EventHandler?
8+
System.Windows.Forms.Form.FormCaptionTextColorChanged -> System.EventHandler?
9+
System.Windows.Forms.Form.FormCornerPreferenceChanged -> System.EventHandler?
410
System.Windows.Forms.Form.ShowAsync(System.Windows.Forms.IWin32Window? owner = null) -> System.Threading.Tasks.Task!
511
System.Windows.Forms.Form.ShowDialogAsync() -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
612
System.Windows.Forms.Form.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner) -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
13+
System.Windows.Forms.FormCornerPreference
14+
System.Windows.Forms.FormCornerPreference.Default = 0 -> System.Windows.Forms.FormCornerPreference
15+
System.Windows.Forms.FormCornerPreference.DoNotRound = 1 -> System.Windows.Forms.FormCornerPreference
16+
System.Windows.Forms.FormCornerPreference.Round = 2 -> System.Windows.Forms.FormCornerPreference
17+
System.Windows.Forms.FormCornerPreference.RoundSmall = 3 -> System.Windows.Forms.FormCornerPreference
18+
System.Windows.Forms.SystemColorMode
19+
System.Windows.Forms.SystemColorMode.Classic = 0 -> System.Windows.Forms.SystemColorMode
20+
System.Windows.Forms.SystemColorMode.Dark = 2 -> System.Windows.Forms.SystemColorMode
21+
System.Windows.Forms.SystemColorMode.System = 1 -> System.Windows.Forms.SystemColorMode
722
System.Windows.Forms.VisualStyles.ComboBoxState.Focused = 5 -> System.Windows.Forms.VisualStyles.ComboBoxState
23+
virtual System.Windows.Forms.Form.OnFormBorderColorChanged(System.EventArgs! e) -> void
24+
virtual System.Windows.Forms.Form.OnFormCaptionBackColorChanged(System.EventArgs! e) -> void
25+
virtual System.Windows.Forms.Form.OnFormCaptionTextColorChanged(System.EventArgs! e) -> void
26+
virtual System.Windows.Forms.Form.OnFormCornerPreferenceChanged(System.EventArgs! e) -> void

0 commit comments

Comments
 (0)