是否可以告诉Visual Studio中不以治疗源文件作为"组分QUOT ;? [英] Is it possible to tell Visual Studio not to treat a source file as a "component"?

查看:180
本文介绍了是否可以告诉Visual Studio中不以治疗源文件作为"组分QUOT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
是否有我可以添加到一个类的属性,所以它会被编辑的代码,而不是在设计师?

类具有系统.ComponentModel.Component 他们的产业道路上被自动视为Visual Studio中(2008年)内的组成部分,触发源文件不同的图标:

Class with System.ComponentModel.Component on their inheritance path are automatically treated as "components" within Visual Studio (2008), triggering a different icon for the source file:

虽然图标都无所谓,更改后双击的行为实在是烦人:不是在文本编辑器中打开源代码时,Visual Studio现在显示屏幕鼓励我通过拖动从工具箱中的将组件添加到我的课。我不想做!

While the icon does not really matter, the changed double click behavior is really annoying: instead of opening the source code in the text editor, Visual Studio now shows a screen encouraging me to add components to my class by dragging them "from the Toolbox". I do not want to do that!

我知道我可以用鼠标右键单击源文件,然后选择查看代码,但每当我忘记这样做,我我坚持等待一个对话框,这是绝对没有用的。有没有什么办法来禁用成分的行为(最好在源代码中)?

I am aware that I can right click the source file and choose "View Code", but whenever I forget to do this, I am stuck waiting for a dialog which is absolutely useless. Is there any way to disable the component behavior (preferably in the source code)?

推荐答案

无法使用 DesignerCategory 属性来装饰你的课吗?

Can't you use the DesignerCategory attribute to decorate your class ?

当像下面显示这个属性装饰你的类,该文件应打开代码视图,当您双击它:

When decorating your class with this attribute like displayed below, the file should open in 'code view' when you double click it:

[System.ComponentModel.DesignerCategory("Code")]
public class MyComponent
{
}

这篇关于是否可以告诉Visual Studio中不以治疗源文件作为"组分QUOT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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