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";
}
}
}
{
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";
}
}
}