ThisAddIn类是加载项的入口,通过InternalStartup()方法初始化。
InternalStartup()方法内添加了加载项的启动和关闭事件
private void InternalStartup() { this.Startup += new System.EventHandler(ThisAddIn_Startup); this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); }
在启动事件处理函数中做一些初始化处理,如生成用户控制面板等
创建自定义面板,并设置显示位置
public CustomTaskPane assetSearchTaskPane = null; private void ThisAddIn_Startup(object sender, System.EventArgs e) { UserControl1 assetSearchUC = new UserControl1(); assetSearchTaskPane = this.CustomTaskPanes.Add(assetSearchUC, " "); assetSearchTaskPane.Width = 600; assetSearchTaskPane.Visible = false; assetSearchTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionLeft; }
设置面板显示位置
customTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionLeft;
给comboBox添加选项
//業種のcomboboxの初期化 public void initComboboxIndustryType1() { initIndustryData2(); Dictionary