Skip to content

Fix top-level window size for non-linear dimensions based on AutoScaleMode - #7973

Merged
dreddy-work merged 9 commits into
mainfrom
dev/dreddy/UpdateTopLevelWindowSize
Oct 21, 2022
Merged

Fix top-level window size for non-linear dimensions based on AutoScaleMode#7973
dreddy-work merged 9 commits into
mainfrom
dev/dreddy/UpdateTopLevelWindowSize

Conversation

@dreddy-work

@dreddy-work dreddy-work commented Oct 19, 2022

Copy link
Copy Markdown
Member

In PermonV2 mode applications, We have been using linear sizes for top-level windows that are provided by the Windows irrespective of the AutoScaleMode. This has been problematic for AutoScaleMode.Font, where Form scaling should be non-linear given its child controls are scaled non-linearly and depend on the Font that was assigned to Form/child controls.

We are making changes to utilize GetDpiScaledSize message and let Windows know that Form may need non-linear sizes depending on AutoScaleMode.

fixes #8089

Microsoft Reviewers: Open in CodeFlow
@dreddy-work
dreddy-work requested a review from a team as a code owner October 19, 2022 23:03
@ghost ghost assigned dreddy-work Oct 19, 2022
@RussKie
RussKie self-requested a review October 19, 2022 23:22
@dreddy-work dreddy-work added the 📖 documentation: breaking please open a breaking change issue https://github.com/dotnet/docs/issues/new?assignees=gewarren label Oct 19, 2022
@dreddy-work

Copy link
Copy Markdown
Member Author

Tests pass locally. Need to investigate.

Comment thread src/System.Windows.Forms/src/System/Windows/Forms/ContainerControl.cs Outdated
Comment thread src/System.Windows.Forms/src/System/Windows/Forms/ContainerControl.cs Outdated
Comment thread src/System.Windows.Forms/src/System/Windows/Forms/Form.cs Outdated
Comment thread src/System.Windows.Forms/src/System/Windows/Forms/Form.cs Outdated
Comment thread src/System.Windows.Forms/src/System/Windows/Forms/Form.cs Outdated
Comment thread src/System.Windows.Forms/src/System/Windows/Forms/Form.cs Outdated
Comment thread src/System.Windows.Forms/src/System/Windows/Forms/Form.cs Outdated
@RussKie RussKie added the waiting-author-feedback The team requires more information from the author label Oct 20, 2022
@ghost ghost removed the waiting-author-feedback The team requires more information from the author label Oct 20, 2022
@RussKie RussKie added the waiting-author-feedback The team requires more information from the author label Oct 20, 2022
@ghost ghost removed the waiting-author-feedback The team requires more information from the author label Oct 20, 2022
@KlausLoeffelmann

Copy link
Copy Markdown
Member

We have been using linear sizes for top-level windows that are provided by the Windows irrespective of the AutoScaleMode.

I don't understand what that means. Do you have a screenshot or a GIF which could illustrate that?

@KlausLoeffelmann KlausLoeffelmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a question and a few typo nits.

Comment thread src/System.Windows.Forms/src/System/Windows/Forms/Form.cs
Comment thread src/System.Windows.Forms/src/System/Windows/Forms/Form.cs Outdated
Comment thread src/System.Windows.Forms/src/System/Windows/Forms/ContainerControl.cs Outdated
@dreddy-work

dreddy-work commented Oct 20, 2022

Copy link
Copy Markdown
Member Author

We have been using linear sizes for top-level windows that are provided by the Windows irrespective of the AutoScaleMode.

I don't understand what that means. Do you have a screenshot or a GIF which could illustrate that?

Gif may not justify but let me try describing this:

When you move Form from 100% monitor to 200% monitor, factor become 2 for both width and height. Windows use this factor and scale the Form. However, when AutoScaleMode is Font, for the same move operation, Factors will not be linear and have separate factors for Width and Height (i.e width factor - 2.1 and height factor 1.95 etc) .

RussKie
RussKie previously approved these changes Oct 20, 2022

@RussKie RussKie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 with few nits

Comment thread src/System.Windows.Forms/src/System/Windows/Forms/ContainerControl.cs Outdated
Comment thread src/System.Windows.Forms/src/System/Windows/Forms/ContainerControl.cs Outdated
Comment thread src/System.Windows.Forms/src/System/Windows/Forms/Form.cs Outdated
Address feedback

Co-authored-by: Igor Velikorossov <RussKie@users.noreply.github.com>
Co-authored-by: Klaus Löffelmann <9663150+KlausLoeffelmann@users.noreply.github.com>
@dreddy-work
dreddy-work enabled auto-merge October 21, 2022 00:14
@dreddy-work
dreddy-work disabled auto-merge October 21, 2022 00:34
@dreddy-work
dreddy-work merged commit 76ce50b into main Oct 21, 2022
@dreddy-work
dreddy-work deleted the dev/dreddy/UpdateTopLevelWindowSize branch October 21, 2022 00:34
@ghost ghost added this to the 8.0 Preview1 milestone Oct 21, 2022
@dreddy-work

Copy link
Copy Markdown
Member Author

Thank you.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 1, 2022
@dreddy-work

Copy link
Copy Markdown
Member Author
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

📖 documentation: breaking please open a breaking change issue https://github.com/dotnet/docs/issues/new?assignees=gewarren

3 participants