Net没有可视组件的组件类

Net没有可视组件的组件类

本文介绍了.Net没有可视组件的组件类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了许多在其祖先中包含IComponent的.net类。这些类没有可视化元素,需要设计视图;但是,作为组件,它们的默认视图是设计视图而不是代码视图。是否有一些机制可以强制这些项在Visual Studio中双击它们而不是打开无用的设计视图时打开代码视图?如果是这样,请指出我的解决方案。似乎是一个简单的问题,但要么我的搜索功能今天都很弱或者不是那么简单。



提前致谢!

- Marc A. Brown

I've created a number of .net classes that include IComponent in their ancestry. These classes have no visual elements to them that would require a design view; however, as components the default view for them is the design view rather than code view. Is there some mechanism to force these items to open the code view when double-clicking them in Visual Studio rather than opening a useless design view? If so, please point me toward a solution. Seems a simple issue but either my search-fu skills are weak today or it's not so simple.

Thanks in advance!
--Marc A. Brown

推荐答案


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





完整的属性名称是必需的,你会发现 [DesignerCategory ()] 并且System.ComponentModel的using namespace指令将不起作用。



Alan。



The full attribute name is required and you'll find that [DesignerCategory("")] and a using namespace directive for System.ComponentModel won't work.

Alan.


这篇关于.Net没有可视组件的组件类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 06:10