-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Update anchors with Windows suggested rectangle in case of top-level window #9214
Conversation
src/System.Windows.Forms/src/System/Windows/Forms/Layout/DefaultLayout.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/ContainerControl.cs
Outdated
Show resolved
Hide resolved
@@ -1453,8 +1453,25 @@ internal void ScaleContainerForDpi(int deviceDpiNew, int deviceDpiOld, Rectangle | |||
// events on the control. | |||
|
|||
// Bounds are being scaled for the top-level window via SuggestedRectangle. We would need to skip scaling of |
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.
You still reference SuggestedRectangle in this comment
(WINDOW_EX_STYLE)cp.ExStyle, | ||
(uint)deviceDpiNew); | ||
#pragma warning restore CA1416 // Validate platform compatibility | ||
WindowsSuggestedClientRectangle = new Rectangle( |
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.
Consider Inflating
rectangle with negative width/height - https://learn.microsoft.com/en-us/dotnet/api/system.drawing.rectangle.inflate?view=net-7.0#system-drawing-rectangle-inflate(system-int32-system-int32)
// this control further by the 'OnFontChanged' event. | ||
_isScaledByDpiChangedEvent = true; | ||
// this control further by the 'OnFontChanged' event. WindowsSuggestedClientRectangle property will help in that. | ||
WindowsSuggestedClientRectangle = suggestedRectangle; |
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.
There is a chance that this rectangle would not be used, i.e. there are no children to anchor. So calculation of the client rect could be delayed until needed.
Fixes #9200.
Microsoft Reviewers: Open in CodeFlow