-
Notifications
You must be signed in to change notification settings - Fork 185
Update autoscale article for modern .NET DPI handling #2157
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
base: main
Are you sure you want to change the base?
Conversation
…de updates Co-authored-by: adegeo <67293991+adegeo@users.noreply.github.com>
|
@copilot One thing I noticed is that it says it's configured through the project. While that is true, I believe you can still override it with the app manifest. |
Co-authored-by: adegeo <67293991+adegeo@users.noreply.github.com>
Added a NOTE clarifying that app.manifest can still override the project file settings, though it's discouraged due to potential conflicts. The note links to the WFO0003 compiler warning documentation for more details. (63bc3bc) |
|
@copilot We should mention something about the designer: https://learn.microsoft.com/en-us/visualstudio/designers/disable-dpi-awareness?view=visualstudio |
…aware property Co-authored-by: adegeo <67293991+adegeo@users.noreply.github.com>
Added a subsection about Visual Studio designer considerations, including the |
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 comprehensively rewrites the autoscale.md article to reflect how DPI handling works in modern .NET (6.0+) instead of .NET Framework. The update addresses a documentation gap where the article was incorrectly describing .NET Framework behavior as current .NET behavior.
Changes:
- Added new sections explaining modern .NET DPI configuration through project file properties
- Added detailed information about high DPI improvements in .NET 6, 7, and 8
- Added a section explaining differences between .NET Framework and modern .NET
- Applied Microsoft Style Guide transformations throughout the document
- Added AI-usage disclosure to frontmatter
| - `SystemAware`—The application queries for the DPI once at startup and uses this value for the lifetime of the app. | ||
| - `PerMonitor`—The application checks for DPI changes on a per-monitor basis and rescales when DPI changes. | ||
| - `PerMonitorV2`—Similar to `PerMonitor`, but enables child window DPI change notifications and improved scaling behavior. | ||
| - `DpiUnaware`—The application doesn't scale for DPI changes, and Windows handles the scaling. | ||
| - `DpiUnawareGdiScaled`—Similar to `DpiUnaware` but provides better quality for GDI-based content. |
Copilot
AI
Jan 21, 2026
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 list items describing DPI modes are missing periods at the end of each item. According to the Microsoft Style Guide, list items that are complete sentences (or longer than three words) must end with periods. Each of these list items is a complete sentence describing what each mode does, so they should all end with periods.
| - **Per-monitor DPI awareness**—Applications dynamically adjust when moved between monitors with different DPI settings. | ||
| - **Improved scaling behavior**—Controls scale correctly when DPI changes, including nested controls and container controls (.NET 6+). | ||
| - **Form size scaling**—<xref:System.Windows.Forms.Form.MaximumSize%2A> and <xref:System.Windows.Forms.Form.MinimumSize%2A> properties scale based on the current monitor DPI settings (.NET 7+, enabled by default in .NET 8+). |
Copilot
AI
Jan 21, 2026
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 list items describing High DPI improvements are missing periods at the end of each item. According to the Microsoft Style Guide, list items that are more than three words must end with periods. The first three list items (lines 106-108) are complete sentences or phrases that are longer than three words, so they should all end with periods. Note that line 109 correctly ends with a colon because it introduces nested items.
| - In .NET Framework, configure DPI awareness through an *app.config* file with the `<System.Windows.Forms.ApplicationConfigurationSection>` element. | ||
| - In modern .NET, configure DPI awareness through the project file with the `ApplicationHighDpiMode` property. | ||
| - .NET Framework uses manifest files for DPI configuration, which is no longer recommended. | ||
| - Modern .NET provides better scaling behavior and more reliable DPI change handling. |
Copilot
AI
Jan 21, 2026
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 list items describing .NET Framework differences are missing periods at the end of each item. According to the Microsoft Style Guide, list items that are more than three words must end with periods. These list items are complete sentences, so they should all end with periods.
| - <xref:System.Windows.Forms.Form.DpiChanged>—Fires when the DPI setting changes on the display device where the form is currently displayed. | ||
| - <xref:System.Windows.Forms.Control.DpiChangedBeforeParent>—Fires when the DPI setting for a control changes programmatically before a DPI change event for its parent control or form occurs. | ||
| - <xref:System.Windows.Forms.Control.DpiChangedAfterParent>—Fires when the DPI setting for a control changes programmatically after a DPI change event for its parent control or form occurs. |
Copilot
AI
Jan 21, 2026
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 list items describing DPI change events are missing periods at the end of each item. According to the Microsoft Style Guide, list items that are more than three words must end with periods. These list items are complete sentences describing what each event does, so they should all end with periods.
| - Override the <xref:System.Windows.Forms.Control.ScaleChildren%2A> property to determine if their child controls should be scaled. | ||
|
|
||
| - Override the <xref:System.Windows.Forms.Control.GetScaledBounds%2A> method to adjust the bounds that the control is scaled to, but not the scaling logic. | ||
|
|
||
| - Override the <xref:System.Windows.Forms.Control.ScaleControl%2A> method to change the scaling logic for the current control. |
Copilot
AI
Jan 21, 2026
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 list items describing how child controls can modify their scaling behavior are missing periods at the end of each item. According to the Microsoft Style Guide, list items that are more than three words must end with periods. These list items are complete sentences, so they should all end with periods.
| - In response to the <xref:System.Windows.Forms.Control.OnFontChanged%2A> event if the scaling mode is <xref:System.Windows.Forms.AutoScaleMode.Font>. | ||
|
|
||
| - When the layout of the container control resumes and a change is detected in the <xref:System.Windows.Forms.ContainerControl.AutoScaleDimensions%2A> or <xref:System.Windows.Forms.ContainerControl.AutoScaleMode%2A> properties. | ||
|
|
||
| - As implied above, when a parent <xref:System.Windows.Forms.ContainerControl> is being scaled. Each container control is responsible for scaling its children using its own scaling factors and not the one from its parent container. | ||
| - When a parent <xref:System.Windows.Forms.ContainerControl> is being scaled. Each container control is responsible for scaling its children using its own scaling factors and not the one from its parent container. |
Copilot
AI
Jan 21, 2026
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 list items describing situations when PerformAutoScale is invoked are missing periods at the end of each item. According to the Microsoft Style Guide, list items that are more than three words must end with periods. These list items are complete sentences, so they should all end with periods.
| title: "Automatic form scaling" | ||
| description: "A look into how Windows Forms for .NET handles scaling the UI." | ||
| description: "Learn how Windows Forms for .NET handles scaling the UI with DPI awareness and automatic scaling modes." | ||
| ms.date: 10/26/2020 |
Copilot
AI
Jan 21, 2026
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 date in the frontmatter hasn't been updated to reflect this major rewrite of the article. Since this is a comprehensive update that significantly changes the content to reflect modern .NET (6.0+) instead of .NET Framework, the date should be updated to the current date when this PR is merged.
| ms.date: 10/26/2020 | |
| ms.date: 01/21/2026 |
Rewrite autoscale article to reflect current DPI settings for modern .NET
Summary of Changes
This PR completely rewrites the autoscale.md article to accurately reflect how DPI handling works in modern .NET (6.0+) instead of .NET Framework.
Latest Updates (addressing feedback)
ForceDesignerDPIUnawareproperty for .NET 6+ projects in Visual Studio 2022 17.8+Technical Content Updates
Added "DPI awareness in modern .NET" section - Explains how modern .NET (6+) handles DPI configuration differently:
ApplicationHighDpiModeproject property (default:SystemAware)PerMonitorV2mode for best multi-monitor scalingForceDesignerDPIUnawarepropertyAdded "High DPI improvements" section - Details modern .NET improvements:
Added ".NET Framework differences" section - Clarifies configuration differences:
Updated existing content - Modernized all sections:
Microsoft Style Guide Compliance
Applied comprehensive style transformations per the Markdown Writing Style Instructions:
Voice and Tense
Word Choice
Punctuation and Formatting
Metadata
ai-usage: ai-assistedto frontmatterVerification Completed
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Internal previews