读书人

VS2005开发Addin时怎么知道设计器上

发布时间: 2012-01-12 22:11:58 作者: rapoo

VS2005开发Addin时,如何知道设计器上的控件和属性。
请知道的给个提示,我死活也没找出来 。因为不想去读 代码来识别。想直接使用 接口提供的 对象来操纵。


[解决办法]
我会
[解决办法]
有人
[解决办法]
http://www.cnblogs.com/dudu/archive/2007/02/06/642229.html
http://www.cnblogs.com/dudu/archive/2007/02/01/635746.html
[解决办法]
http://www.chenjiliang.com/Article/View.aspx?ArticleID=513&TypeID=73
[解决办法]
addin是什么意思?
[解决办法]
public void AddControlsDelegate(DTE2 dte)
{
Project prj = (Project)((Array)dte.ActiveSolutionProjects).GetValue(0);
ProjectItem item = prj.ProjectItems.Item( "Form1.cs ") as ProjectItem;
Window itemDesigner = item.Open(Constants.vsViewKindDesigner);
itemDesigner.Activate();
IDesignerHost host = itemDesigner.Object as IDesignerHost;

IContainer ic = host.Container;

(ic.Components[ "textBox1 "] as System.Windows.Forms.TextBox).Size = new Size(200, 21);

foreach (IComponent cp in ic.Components)
{
if (cp is System.Windows.Forms.Button)
{
(cp as System.Windows.Forms.Button).Text = "aa ";
}
}
}

读书人网 >C#

热点推荐