Visual Studio:使视图代码默认

有什么办法使Visual Studio显示控件/窗体的代码,而不是devise器? 我倾向于成为devise师的粉丝,因为他们增加了膨胀。

用鼠标右键单击文件,然后select“打开方式…”

select“CSharp编辑器”,然后点击“设为默认”。

用[System.ComponentModel.DesignerCategory(“”)]装饰你的类,例如:

[System.ComponentModel.DesignerCategory("")] public class MySpecialButton : System.Windows.Forms.Button { } 

我喜欢在Design View中打开我的表单,但是我创build了一个只有代码的部分类文件,而Visual Studio想要在Design View中始终打开它。 为防止Visual Studio意识到Designer可以加载特定的源文件,请查看适当源文件的Compile Include标签的csproj文件,并删除其下的SubType标签。

我最近自己碰到这个问题,上面的解决scheme没有解决我的问题。 我需要进入Tools | Options Tools | Options并更改HTML Designer的设置以Enable HTML designer HTML Designer ,然后selectStart pages in: Source View

设置截图