标题栏在带有 .net 5 的 Windows 窗体应用程序中显示不需要

问题描述

在我们的应用程序中,我们尝试给应用程序一个自己的样式并尝试隐藏窗口样式。因此,主窗体设置为无边框,没有控制框等等。这在最近几年运行良好,实际上我们使用的是 VS 2019,实际应用程序设置为 .net core 3.1

设计器代码如下

  this.ControlBox = false;
  this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
  this.IsMdiContainer = true;
  this.MaximizeBox = false;
  this.MinimizeBox = false;
  this.ShowIcon = false;

如您所见,主要形式是 MDI Contrainer。实际上应用程序的顶部是这样的,只有我的标题栏没有控制框。

enter image description here

几天前,我们更改为 .net 5.0,现在我注意到,在那一刻,当我向 mdicontainer 添加子表单时,会出现 Windows 标题栏。

_GeneralForm = new FEmpty();
this._GeneralForm.MdiParent = this; // A that point the title bar appears in the main form
.WindowState = FormWindowState.Maximized;

可能是什么原因?在调试器中,我可以检查主窗体(即 mdi 容器)是否仍然设置为 FormBorderstyle.None 以及所有其他设置与设计器代码中所做的一样。

enter image description here

今天试了VS2019 V16.10,错误依旧。

问候弗兰克

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)