Skip to content

Conversation

@dreddy-work
Copy link
Member

@dreddy-work dreddy-work commented Nov 5, 2021

Fix nested Container Controls scaling that have AutoscaleMode as Inherit. In this change we are making sure to traverse hierarchy all the way up until we get a container parent whose AutoScaleMode is not Inherit and use it s AutoScaleFactor to scale children.

Fixes #5957.

fixes #6152

Microsoft Reviewers: Open in CodeFlow

@dreddy-work dreddy-work requested a review from a team as a code owner November 5, 2021 19:35
@ghost ghost assigned dreddy-work Nov 5, 2021
@dreddy-work dreddy-work added the waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) label Nov 5, 2021
// Traverse thorugh parent hierarchy untill we get a ContainerControl whose AutoScaleMode is not Inherit.
// AutoscaleFactor from this parent is used to scale the child controls within its hierarchy.
while (parentControl is not null
&& (parentControl is not ContainerControl containerControl
Copy link
Contributor

@Tanya-Solyanik Tanya-Solyanik Nov 5, 2021

Choose a reason for hiding this comment

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

We have other places with similar code walking the parent chain, don't we? Do we always skip non-container controls?

Copy link
Member Author

Choose a reason for hiding this comment

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

AutoscaleFactor is property on ContainerControl . So, we have to traverse parent chain until we get the right scale factor for its children. Also, ContainerControl gets OnFonChanged events to scale the children. Non-Container controls that receive OnFontChanged does not scale control but just set the Font.

@dreddy-work dreddy-work removed the waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) label Nov 10, 2021
@dreddy-work dreddy-work merged commit 92921bb into main Nov 10, 2021
@dreddy-work dreddy-work deleted the dev/dreddy/fix5957 branch November 10, 2021 18:17
@ghost ghost added this to the 7.0 alpha1 milestone Nov 10, 2021
@dreddy-work
Copy link
Member Author

CTI cleared testing.

dreddy-work added a commit that referenced this pull request Nov 10, 2021
…rit (#6130)

* Fix nested container controls scaling that have AutoscaleMode as Inherit.

Fixes #5957 and #6152.
filipnavara pushed a commit to emclient/winforms that referenced this pull request Nov 11, 2021
…rit (dotnet#6130)

* Fix nested container controls scaling that have AutoscaleMode as Inherit.

Fixes dotnet#5957 and dotnet#6152.
dreddy-work added a commit that referenced this pull request Nov 11, 2021
…rit (#6130) (#6158)

* Fix nested container controls scaling that have AutoscaleMode as Inherit.

Fixes #5957 and #6152.
@ghost ghost locked as resolved and limited conversation to collaborators Jan 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

4 participants