winforms - Form automatically increasing its width in Visual Studio - Stack Overflow

I'm working on a Windows Forms app in Visual Studio 2022. I've recently upgraded the framewor

I'm working on a Windows Forms app in Visual Studio 2022. I've recently upgraded the framework from .NET 4 to .NET 8 and started development on another (Win11) laptop I haven't used before.

Just noticed that, when running my app (either in Debug or Release mode), after I stop the run process, the Visual Studio's designer gets stuck for a couple of seconds (4-5) before it increases the width of my form. Not drastically, but something noticeable, as my components aren't aligned anymore.

I am also using Krypton for my components, including my form. This means that my form inherits not from the vanilla Form, but from the KryptonForm class. However, I'm not sure if this has any influence on the outcome.

Read a similar question on SO, and it was stated that the problem may be from the AutoScaleMode, to be found under my MainForm.Designer.cs. The flag was indeed set to AutoScaleMode.Dpi, but even after replacing it with AutoScaleMode.Font or even AutoScaleMode.None, the form continued to grow up.

This doesn't only happen at runtime, but also when I (completely) close the designer tab of my form and reopen it. 3-4 seconds of delay, while the form gets resized and I can get back to my job.

I don't think pictures are necessary, but let me know if you need additional information (such as properties, code, etc.).

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744895999a4599700.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信