无法在Designer中修改WinForm上的控件 [英] Controls on WinForm not modifiable in Designer

查看:246
本文介绍了无法在Designer中修改WinForm上的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我继承了一个已被修改的项目,超出了我的撤消范围.表单上的每个控件都不能在设计器中进行修改,除非通过属性"窗口,并且每个控件在通常保留给不可见项(例如DataSource)的部分的下方区域(请参见图片)中都有一个图标.我该如何撤消该操作,然后将设计器恢复为可用版本,而无需全部清除并重新开始?

I've inherited a project that has been modified in a way that is beyond me to undo. Every single control on the form is not modifiable in the designer except through the Properties window and each control has an icon in the area below (see image) in the section usually reserved for non-visible items (e.g. DataSource). How do I undo this and return the designer to a usable version without wiping it all out and starting over?

推荐答案

当用户控件或表单被错误地标记为组件"时,我也看到了这种行为.

I have also seen behavior this when a user control or form is incorrectly flagged as a 'Component'.

.csproj文件的某些手动黑客攻击可能是答案.在文本编辑器中打开项目文件,并找到对该控件的引用.如果找到定义为的子类型:

Some manual hacking of the .csproj file may be the answer then. Open the project file in a text editor, and find the references to your control. If you find a subtype defined as:

<Compile Include="MyControl.cs">
  <SubType>Component</SubType>
</Compile>

表单设计者将对此进行解释.您可以将"SubType"更改为"UserControl"进行修复.

The forms designer will interpret it as such. You can change the 'SubType' to 'UserControl' to fix it.

这篇关于无法在Designer中修改WinForm上的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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