Winform 不显示在设计器中

发布于 2024-07-13 00:51:35 字数 345 浏览 6 评论 0原文

我有一个托管 C++ WinForm,它突然停止在 VS 2005 设计器中显示。 它显示的错误是

找不到类型“int”。 请 确保装配 包含此类型被引用。 如果 该类型是您的一部分 开发项目,确保 该项目已成功 已建成。

我什至不知道从哪里开始。 设计者在渲染表单时是否只访问InitializeComponent(void)方法? 所以我的问题是:从哪里开始解决设计器错误?

编辑:我忘了提及这段代码可以完美构建和运行。 它仅显示 Windows 窗体设计器中的错误。

I have a Managed C++ WinForm that suddenly stopped showing in the VS 2005 designer. The error it shows is

Could not find type 'int'. Please
make sure that the assembly that
contains this type is referenced. If
this type is a part of your
development project, make sure that
the project has been successfully
built.

I don't even know where to start with this one. Does the designer only access the InitializeComponent(void) method when rendering the form? So my question is: where do you start troubleshooting designer errors?

EDIT: I forgot to mention that this code builds and runs perfectly. It only shows an error in the windows forms designer.

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

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

发布评论

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

评论(2

夜无邪 2024-07-20 00:51:35

这是 C# 的故障排除,但我认为这里提到的几点会有所帮助。

“视觉继承”的现状如何

This is troubleshooting for C# but I'd assume a couple of the points mentioned here would help.

What's the state of play with "Visual Inheritance"

撑一把青伞 2024-07-20 00:51:35

这通常是由代码中某处的语法错误引起的,导致设计者无法运行表单来呈现它。 最好的方法通常是阅读代码,寻找问题的额外大括号、丢失的字符串等。好消息是,它很可能很容易找到,因为您知道它位于错误消息中的 INT 之前。

一些可能性:
* 我通常是由于不小心敲击键盘并将一些额外的字符放在文件顶部而导致的
* 额外的大括号使类无法编译 - 缺少引号、分号
* 在顶部键入的内容扰乱了常见的包含/使用语句

诊断
* 有时,您可以通过跟踪构建并查看哪些狮子被标记为错误,然后环顾四周来找到这一点。
* 通常情况下,我只需打开源文件并扫描它以查找问题。

This is usually caused by a syntax error somewhere in the code that causes the designer to be unable to run the form to render it. The best method for this is ofent sadly just reading the code looking for the problem extra brace, missing string etc. The good news is that it is most likely easy to find since you know that it preceeds the INT in the error message.

Some possibilities:
* I cause this usually by accidentally hitting the keybaord and putting some extra characters at the top of a file
* Extra braces that make the class uncompilable - missing quotes, semicolons
* Something typed at the top that messes up a common include/using statement

Diagnostics
* Sometimes you can find this by dogin a build and seeing what lione is flagged with an error and then looking around it.
* More often then not I have to just open the source file and scan through it looking for the problem.

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