基本表单控件在子表单中不可见

发布于 2024-09-04 15:32:12 字数 221 浏览 8 评论 0原文

我正在使用 C#.Net,并且有一个由多个表单继承的基本表单。

直到昨天,当在设计器中打开子(派生)表单时,将显示基本表单控件并显示为锁定状态。

然而现在表格只是空白。基本表单控件在设计器中都不可见。一切都编译、构建并运行正常。

还有其他人看过这个吗?

我尝试在派生表单 OnLoad 方法中调用基本表单 InitializeComponent 方法,但无济于事。

I'm using C#.Net and have a base form that is inherited by several forms.

Until yesterday, when the child (derived) form was opened in the designer the base forms controls would be displayed and shown as locked.

Now, however the form is simply blank. None of the base forms controls are visible in the designer. Everything compiles, builds and runs OK.

Has anyone else seen this?

I've tried placing a call to the base forms InitializeComponent method in the derived forms OnLoad method but to no avail.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

软甜啾 2024-09-11 15:32:12

在发布问题之前我没有看到的SO帖子中找到了解决方案。

本质上,我需要在基本表单的私有无参数构造函数中调用 InitializeComponent()

private ItemSelectForm()
{
    InitializeComponent();
}

然后需要重建基本形式。

Found solution in a SO post I did not see before posting the question.

Essentially, I needed to place a call to InitializeComponent() in the private no argument constructor of my base form.

private ItemSelectForm()
{
    InitializeComponent();
}

The base form then needs to be rebuilt.

指尖凝香 2024-09-11 15:32:12

我的控制力从我的形态中消失,也是我经历过的经历。在某个地方,也许在 MSDN 上,我读到,不要更改 InitializeComponent(),而是将其保持不变,让机器编译该部分代码。好吧,我经常在 InitializeComponent() 方法中成功地附加、更改和拿走委托,但这次我想向其中提供一个参数:InitializeComponent(string x),以便在不知不觉中为控件提供不同的名称关于控件将从视线中消失但在运行时仍然有效的效果。读完本页后,我现在已经拿走了那个小参数 x,并尝试在 InitializeComponent() 方法之外完成这项工作,并且控件立即重新出现。希望这会有所帮助,即使我没有大量的代码可以添加,也没有理由可以给出。

Disappearance of my controls from my form, is an experience I have undergone, too. Somewhere, maybe on MSDN, I read, do not change the InitializeComponent(), but leave it, untouched and unaltered, to the machine to compile that part of the code. Well, I have often attached and changed and taken away delegates, successfully, inside the InitializeComponent() method, but this time I wanted to feed a parameter into it: InitializeComponent(string x), to give a different name to a control, unknowingly about the effect that the controls would disappear from sight, while still being operative at runtime. After reading this page, I have taken away now that little parameter x, and try to do the job outside the InitializeComponent() method, and the controls have reappeared, immediately. Hope this helps, even if I have no extensive code to add and reasons to give.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文