窗体设计器已无法在Visual Studio中使用窗体 [英] Form designer has became unavailable for a form in Visual Studio

查看:212
本文介绍了窗体设计器已无法在Visual Studio中使用窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2015中处理表单后,表单设计器突然变得不可用。

After some work on form in Visual Studio 2015, form designer suddenly became unavailable.

症状:

    解决方案资源管理器中表单代码类的上下文菜单中缺少
  • 项目视图设计器

  • 通常无法使用键盘快捷键切换到设计器

  • .Designer .resx 文件仍然存在,并正确显示为表单代码类的子树项
  • >
  • .Designer .resx 文件从内部看起来很健康,它们具有每个必不可少的部分

  • Visual Studio报告 0个错误

  • 仅一种形式受到影响,其他形式可以在设计器中正常打开

  • item View Designer is missing from context menu of form code class in Solution Explorer
  • usual keyboard shortcut cannot be used to switch to the designer
  • .Designer and .resx files are still in place and correctly shown as subtree items of form code class
  • .Designer and .resx files look healthy from inside, they have every mandatory part
  • Visual Studio reports 0 errors
  • only one form is affected, other can be open in the designer normally

为什么Visual Studio不将表单文件评估为有效文件,而不显示Designer视图?

Why the Visual Studio is not evaluating form files as valid, not showing Designer view?

推荐答案

我不小心将自己锁定了,在锁定后写了错误消息

I accidentally locked myself out, with error message written behind the locked door.

问题:在工作期间,我暂时将一个简单的帮助程序类添加到了表单代码文件的开头。 如果那段时间我让设计师打开了,我可能会看到以下错误:

Issue: During the work, I temporarily added a trivial helper class to the beginning of the form code file. If I had the designer open that time, I could have seen the following error:


Form1类可以被设计,但不是文件中的头等舱。 Visual Studio要求设计人员使用文件中的第一类。移动类代码,使其成为文件中的第一类,然后尝试再次加载设计器。

The class Form1 can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.

要注意的是, 该错误仅在设计器中显示。如果您现在仅打开代码窗口,则不会发现错误-更糟的是,您将不再被允许进入设计器视图来发现它。

The catch is, the error shows only in the designer. If you have only code window open at the moment, you won't spot the error – and worse, you are no more allowed to enter the designer view to discover it.

因此,在Visual Studio不提供任何线索的情况下可能会发生–唯一的帮助就是合格的猜测和试用。

So a case can happen, when Visual Studio gives no clue – the only help is qualified guess and trial.

这篇关于窗体设计器已无法在Visual Studio中使用窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆