winforms icon indicating copy to clipboard operation
winforms copied to clipboard

[WinForms][AnchorLayoutV2] Updating some panels hierarchy breaks the anchored layout

Open PierreChatelier opened this issue 7 months ago • 2 comments

.NET version

.Net 10.0.06

Did it work in .NET Framework?

Works with legacy AnchorLayout.

Did it work in any of the earlier releases of .NET Core or .NET 5+?

Works with legacy AnchorLayout.

Issue description

There is some controls hierarchy, using AnchorLayoutV2. When resizing the window, one of the inner panels is resized incorrectly if replaced by an equivalent panel after the InitializeComponent(). Strangely, it can be fixed by forcing its Anchor property to None, then back to the original value.

(this is shown in the reproducer)

Steps to reproduce

Here is a minimal reproducer. WinFormsAnchorLayoutBug.zip

PierreChatelier avatar Apr 28 '26 07:04 PierreChatelier

Verified the issue with latest .NET SDK 11.0.100.Preview.5.26256.117 build, the issue has been fixed that the replaced anchored controls continue to resize correctly with the form as below screenshot.

https://github.com/user-attachments/assets/111b7398-2015-4448-a096-f223d7314b85

Zheng-Li01 avatar May 08 '26 01:05 Zheng-Li01

Verified this issue in .NET 11 Preview 5 test pass build: .NET SDK 11.0.100-preview.5.26279.113, it was fixed with the same testing result as above.

Amy-Li03 avatar Jun 02 '26 01:06 Amy-Li03