-
Notifications
You must be signed in to change notification settings - Fork 6.1k
WinForms breaking changes for Preview 1 #33798
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c8f3f40
colordepth default change
gewarren f8a289e
autoscalemode breaking change
gewarren c174bc4
tweaks
gewarren 526abe8
Merge branch 'main' of github.com:dotnet/docs into winforms-prev1
gewarren 200e648
new argument exceptions
gewarren 5195b88
fix affected insert method
gewarren 5d683ac
Apply suggestions from code review
gewarren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
docs/core/compatibility/windows-forms/8.0/exceptioncollection.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| --- | ||
| title: "Breaking change: ExceptionCollection constructor throws ArgumentException" | ||
| description: Learn about the breaking change in .NET 8 for Windows Forms where the ExceptionCollection constructor now throws an exception if the input is not of type Exception. | ||
| ms.date: 02/06/2023 | ||
| --- | ||
| # ExceptionCollection ctor throws ArgumentException | ||
|
|
||
| The <xref:System.ComponentModel.Design.ExceptionCollection> constructor now throws an <xref:System.ArgumentException> if the elements in the input array are not of type <xref:System.Exception>. | ||
|
|
||
| ## Version introduced | ||
|
|
||
| .NET 8 Preview 1 | ||
|
|
||
| ## Previous behavior | ||
|
|
||
| Previously, the <xref:System.ComponentModel.Design.ExceptionCollection> constructor did not check the type passed in, which could delay failure until later in the process. No exceptions were thrown during object creation. | ||
|
|
||
| ## New behavior | ||
|
|
||
| Starting in .NET 8, if the elements in the input array are not of type <xref:System.Exception>, an <xref:System.ArgumentException> is thrown. | ||
|
|
||
| ## Change category | ||
|
|
||
| This change is a [*behavioral change*](../../categories.md#behavioral-change). | ||
|
|
||
| ## Reason for change | ||
|
|
||
| This change helps to make exception types consistent across the code base. | ||
|
|
||
| ## Recommended action | ||
|
|
||
| For most scenarios, this change should not have a significant impact. However, consider updating your code to handle <xref:System.ArgumentException> at constructor call sites. | ||
|
|
||
| ## Affected APIs | ||
|
|
||
| - <xref:System.ComponentModel.Design.ExceptionCollection.%23ctor(System.Collections.ArrayList)> constructor | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
docs/core/compatibility/windows-forms/8.0/imagelist-colordepth.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| --- | ||
| title: "Breaking change: ImageList.ColorDepth default is Depth32Bit" | ||
| description: Learn about the breaking change in .NET 8 for Windows Forms where the default value of ImageList.ColorDepth has changed from Depth8Bit to Depth32Bit. | ||
| ms.date: 01/31/2023 | ||
| --- | ||
| # ImageList.ColorDepth default is Depth32Bit | ||
|
|
||
| The default value for <xref:System.Windows.Forms.ImageList.ColorDepth?displayProperty=nameWithType> has changed over time. Starting in .NET 8, the default value has changed from <xref:System.Windows.Forms.ColorDepth.Depth8Bit> to <xref:System.Windows.Forms.ColorDepth.Depth32Bit>. This change affects both new and existing applications if they're upgraded to target .NET 8. | ||
|
|
||
| ## Version introduced | ||
|
|
||
| .NET 8 Preview 1 | ||
|
|
||
| ## Previous behavior | ||
|
|
||
| The default value for <xref:System.Windows.Forms.ImageList.ColorDepth?displayProperty=nameWithType> was <xref:System.Windows.Forms.ColorDepth.Depth8Bit?displayProperty=nameWithType>. | ||
|
|
||
| ## New behavior | ||
|
|
||
| If you haven't explicitly set <xref:System.Windows.Forms.ImageList.ColorDepth?displayProperty=nameWithType> for an image list, the color depth will automatically be reset to <xref:System.Windows.Forms.ColorDepth.Depth32Bit?displayProperty=nameWithType>. This could increase your app's memory usage. | ||
|
|
||
| ## Change category | ||
|
|
||
| This change is a [*behavioral change*](../../categories.md#behavioral-change). | ||
|
|
||
| ## Reason for change | ||
|
|
||
| The default value was changed to improve image quality. | ||
|
|
||
| ## Recommended action | ||
|
|
||
| If you want to continue using the previous color depth, explicitly set <xref:System.Windows.Forms.ImageList.ColorDepth?displayProperty=nameWithType> to <xref:System.Windows.Forms.ColorDepth.Depth8Bit?displayProperty=nameWithType>. | ||
|
|
||
| ## Affected APIs | ||
|
|
||
| - <xref:System.Windows.Forms.ImageList.ColorDepth?displayProperty=fullName> |
38 changes: 38 additions & 0 deletions
38
docs/core/compatibility/windows-forms/8.0/tablelayoutstylecollection.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| --- | ||
| title: "Breaking change: TableLayoutStyleCollection throws ArgumentException" | ||
| description: Learn about the breaking change in .NET 8 for Windows Forms where inserting or removing an object that's not a TableLayoutStyle throws an exception. | ||
| ms.date: 02/06/2023 | ||
| --- | ||
| # TableLayoutStyleCollection throws ArgumentException | ||
|
|
||
| <xref:System.Windows.Forms.TableLayoutStyleCollection> enforces the type passed to its collection operations. The [affected APIs](#affected-apis) now throw an <xref:System.ArgumentException> instead of an <xref:System.InvalidCastException> if the input is not of type <xref:System.Windows.Forms.TableLayoutStyle>. | ||
|
|
||
| ## Version introduced | ||
|
|
||
| .NET 8 Preview 1 | ||
|
|
||
| ## Previous behavior | ||
|
|
||
| Previously, if the input couldn't be converted to type <xref:System.Windows.Forms.TableLayoutStyle>, an <xref:System.InvalidCastException> was thrown. | ||
|
|
||
| ## New behavior | ||
|
|
||
| Starting in .NET 8, if the input can't be converted to type <xref:System.Windows.Forms.TableLayoutStyle>, an <xref:System.ArgumentException> is thrown. | ||
|
|
||
| ## Change category | ||
|
|
||
| This change is a [*behavioral change*](../../categories.md#behavioral-change). | ||
|
|
||
| ## Reason for change | ||
|
|
||
| This change helps to make exception types consistent across the code base. | ||
|
|
||
| ## Recommended action | ||
|
|
||
| For most scenarios, this change should not have a significant impact. However, if you previously handled <xref:System.InvalidCastException>, update your code to handle <xref:System.ArgumentException> instead. | ||
|
|
||
| ## Affected APIs | ||
|
|
||
| - <xref:System.Windows.Forms.TableLayoutStyleCollection.System%23Collections%23IList%23Add(System.Object)?displayProperty=fullName> | ||
| - <xref:System.Windows.Forms.TableLayoutStyleCollection.System%23Collections%23IList%23Insert(System.Int32,System.Object)?displayProperty=fullName> | ||
| - <xref:System.Windows.Forms.TableLayoutStyleCollection.System%23Collections%23IList%23Remove(System.Object)?displayProperty=fullName> |
42 changes: 42 additions & 0 deletions
42
docs/core/compatibility/windows-forms/8.0/top-level-window-scaling.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| --- | ||
| title: "Breaking change: Forms scale according to AutoScaleMode" | ||
| description: Learn about the breaking change in .NET 8 for Windows Forms where top-level windows in PerMonitorV2-mode apps scale according to AutoScaleMode. | ||
| ms.date: 01/31/2023 | ||
| --- | ||
| # Forms scale according to AutoScaleMode | ||
|
|
||
| In <xref:System.Windows.Forms.HighDpiMode.PerMonitorV2>-mode apps, Windows Forms has been using linear sizes (also known as DPI-scaled sizes) provided by Windows for top-level windows, regardless of the <xref:System.Windows.Forms.AutoScaleMode>. This implementation was problematic when using the <xref:System.Windows.Forms.AutoScaleMode.Font?displayProperty=nameWithType> scaling mode, where <xref:System.Windows.Forms.Form> scaling should be non-linear. The child controls are scaled non-linearly and depend on the font that was assigned to the <xref:System.Windows.Forms.Form> or child controls. | ||
|
|
||
| This change enables `WM_GETDPISCALEDSIZE` message handling for top-level <xref:System.Windows.Forms.Form> objects. It utilizes [WM_GETDPISCALEDSIZE](/windows/win32/hidpi/wm-getdpiscaledsize) to let Windows know that the <xref:System.Windows.Forms.Form> may need non-linear sizes depending on <xref:System.Windows.Forms.AutoScaleMode>. | ||
|
|
||
| ## Version introduced | ||
|
|
||
| .NET 8 Preview 1 | ||
|
|
||
| ## Previous behavior | ||
|
|
||
| Previously, in <xref:System.Windows.Forms.HighDpiMode.PerMonitorV2>-mode apps, top-level windows were scaled by Windows and disregarded <xref:System.Windows.Forms.AutoScaleMode> as specified in the WinForms application. This implementation led to inconsistent scaling between <xref:System.Windows.Forms.Form> objects and their child controls. | ||
|
|
||
| ## New behavior | ||
|
|
||
| In <xref:System.Windows.Forms.HighDpiMode.PerMonitorV2>-mode apps, top-level windows (such as [Forms](xref:System.Windows.Forms.Form)) are scaled according to <xref:System.Windows.Forms.AutoScaleMode>. This implementation ensures that top-level windows scale consistently with their child controls. | ||
|
|
||
| ## Change category | ||
|
|
||
| This change is a [*behavioral change*](../../categories.md#behavioral-change). | ||
|
|
||
| ## Reason for change | ||
|
|
||
| This change was made to improve the high-DPI experience for Windows Forms apps in <xref:System.Windows.Forms.HighDpiMode.PerMonitorV2> mode. | ||
|
|
||
| ## Recommended action | ||
|
|
||
| No action is required. | ||
|
|
||
| ## Affected APIs | ||
|
|
||
| N/A | ||
|
|
||
| ## See also | ||
|
|
||
| - [Top-level forms scale minimum and maximum size to DPI](forms-scale-size-to-dpi.md) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.