简体   繁体   English

Visual Studio Designer和Toolbox混淆

[英]Visual Studio Designer and Toolbox Confusion

If you create a Windows Service project, a "Service1" class is made for you which has a designer window. 如果您创建Windows服务项目,则会为您创建一个具有设计器窗口的“Service1”类。 Easily 99% of the controls in the Toolbox are unusable in the context of a Windows service, and yet the designer will happily allow things like GUI controls to be dragged and dropped to the designer surface for the service. 工具箱中99%的控件很容易在Windows服务的上下文中无法使用,但设计人员很乐意将诸如GUI控件之类的东西拖放到服务的设计者表面。

Really? 真? REALLY?? 真??

This has been the reality of Visual Studio, going back a few versions, but I've never understood why MS seems uninterested or unaware regarding this oddity. 这是Visual Studio的现实,可以追溯到几个版本,但我从未理解为什么MS似乎对此奇怪不感兴趣或不知道。

But it occurs to me, perhaps there is a rationale of why MS would intentionally keep it this way, and I'm missing the boat. 但它发生在我身上,也许有一个理由说明为什么MS会故意这样做,而我却错过了这条船。 Please explain? 请解释? Or perhaps I simply have a misconfigured VS IDE dev environment, and it works on everyone else's machine. 或者我可能只是配置错误的VS IDE开发环境,它可以在其他人的机器上运行。 If so, how do I fix it? 如果是这样,我该如何解决?

Certainly this does not prevent me from getting my work done, but it can hinder learning efforts or hinder speed of browsing relevant "actually usable" components "for the current designer canvas." 当然,这并不妨碍我完成我的工作,但它可能会妨碍学习工作或阻碍浏览“当前设计师画布”相关“实际可用”组件的速度。

Yes I am aware that sections of the toolbox can be manually collapsed, but that answer doesn't cut it. 是的我知道工具箱的各个部分可以手动折叠,但答案并没有减少它。 Tools as powerful as .net and VS should be capable of determining "which tools are relevant for the current design canvas." 像.net和VS一样强大的工具应该能够确定“哪些工具与当前设计画布相关”。 Perhaps there is a plugin that does this selection for me? 也许有一个插件可以为我做这个选择?

Curious about all this... 对这一切充满好奇......

I think the problem is that the design canvas for services allows the dropping fo components, which are a superclass of controls. 我认为问题在于服务的设计画布允许删除fo组件,这是一组超级控件。 Thus, any control is a component, thus any control can be dropped onto it. 因此,任何控件都是一个组件,因此任何控件都可以放在它上面。

Sure, the IDE could test to see if it also supported a Control interface, but the control might be written to detect if a GUI was supported and act as just a control in such situations. 当然,IDE可以测试它是否也支持Control接口,但是可能会编写控件以检测GUI是否受支持,并且在这种情况下仅充当控件。 Thus, there would be no way for the IDE to know what the control can auto-detect. 因此,IDE无法知道控件可以自动检测的内容。

The only way to make this work would be to force an arbitrary interface that the component would support, and that seems silly. 实现这项工作的唯一方法是强制组件支持的任意接口,这看起来很愚蠢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM