问题描述
我正在为Visual Studio 2010编写外接程序,我希望它可以将控件添加到现有解决方案中现有项目的现有窗体中,并且我已经引用了所有控件。
I am writing na Add-In for Visual Studio 2010, and I want it to add controls to an existing Form in an existing Project in an existing Solution, and I already have references to all of them.
由于我引用了代表表单文件的项目项,因此我想要引用表单本身,那么我将能够对其进行任何处理(更改属性,并添加控件)。
As I have the reference to the Project Item that represents the file of the form, I want a reference to the Form per se, then I’ll be able to do anything to it (changing properties, and adding controls).
我已经尝试了一些方法,尽管我必须承认我并没有用尽所有尝试。但是,由于这是一个非常有趣的主题,所以我决定写这个问题,而不是继续在丛林中奔波,所以对我来说这会更快,并且将来还会有其他人提出类似的疑问。
I have tried some approaches, though I must admit I haven’t ran out of tries. But since this is quite an interesting subject, instead of keeping on beating around the bush, I decided to write this question, so it would be faster for me, and would be registered for future similar doubts from anyone else.
总结:
我有:
EnvDTE.ProjectItem myPrjItemForm
我想拥有:
System.Windows.Forms.Form myFormObject
推荐答案
看看这些文章:
这是VB代码,但据我所知,它说明了您需要执行的步骤
It's VB code, but as far as I can tell, it illustrates the steps you need to perform.
这篇关于当我仅引用窗体的EnvDTE时将控件添加到窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!