微软的原文,在制作OFFICE文档级程序中使用,正确,没有问题。
private void ExcelRangeAddControl()
{ UserControl1 customUserControl = new UserControl1();
UserControl2 customUserControl2 = new UserControl2(); Microsoft.Office.Tools.Excel.ControlSite dynamicControl =
this.Controls.AddControl(customUserControl,
0, 0, 150, 150, "dynamicControl"); Microsoft.Office.Tools.Excel.ControlSite dynamicControl2 =
this.Controls.AddControl(customUserControl2, 200, 0,
150, 150, "dynamicControl2"); customUserControl.BackColor = Color.Blue;
customUserControl2.BackColor = Color.Green; customUserControl.Top = 100;
dynamicControl2.Top = 100;
}
可是,在外接程序中,就需要修改实例化对象(红色的This),请问在外接程序开发中,需要修改成什么。
private void ExcelRangeAddControl()
{ UserControl1 customUserControl = new UserControl1();
UserControl2 customUserControl2 = new UserControl2(); Microsoft.Office.Tools.Excel.ControlSite dynamicControl =
this.Controls.AddControl(customUserControl,
0, 0, 150, 150, "dynamicControl"); Microsoft.Office.Tools.Excel.ControlSite dynamicControl2 =
this.Controls.AddControl(customUserControl2, 200, 0,
150, 150, "dynamicControl2"); customUserControl.BackColor = Color.Blue;
customUserControl2.BackColor = Color.Green; customUserControl.Top = 100;
dynamicControl2.Top = 100;
}
可是,在外接程序中,就需要修改实例化对象(红色的This),请问在外接程序开发中,需要修改成什么。
解决方案 »
- c# 怎样关闭一个窗体打开另一个窗体,在线等
- DataTable给DataGridView绑定了什么时候释放?
- DevExpress.XtraGrid.GridControl的问题[winform]
- 泛型的一点疑问
- c#中select语句中top后动态设置参数怎么做???我出点小问题.急!!!!!!!!!
- 如何让listview只接受第2列的双击事件?对其他列的双击事件不做反映?
- 进来看看,马上散分!!up 多给
- 关于Assembly Version的修改
- <font size=18><b>是不是c#写的webform程序在运行时,要在服务器上安装ie6</b></font>
- 怎么用将数据库中的数据输出成SqlDataReader或写如其他的SqlDataReader?
- 请问,winform连接远程数据库
- C#读取Excel的问题。。。。
public Control objControl
{get;set;}private void ExcelRangeAddControl()
{
UserControl1 customUserControl = new UserControl1();
UserControl2 customUserControl2 = new UserControl2();
Microsoft.Office.Tools.Excel.ControlSite dynamicControl =
objControl.Controls.AddControl(customUserControl,
0, 0, 150, 150, "dynamicControl");
Microsoft.Office.Tools.Excel.ControlSite dynamicControl2 =
objControl.Controls.AddControl(customUserControl2, 200, 0,
150, 150, "dynamicControl2");
customUserControl.BackColor = Color.Blue;
customUserControl2.BackColor = Color.Green;
customUserControl.Top = 100;
dynamicControl2.Top = 100;
}
ExcelAddIn9
这个是对象名,项目名