我做了一个包含任务窗格的测试VSTO Office Addin。是否可以在垂直任务栏上具有最大宽度。
我的代码如下
var taskPaneView = new TaskPane.TaskPaneView();
var myTaskPane= Globals.ThisAddIn.CustomTaskPanes.Add(taskPaneView, "Create");
myTaskPane.Visible = true;
taskPaneView.BackColor = Color.FromArgb(202, 57, 4);
taskPaneView.Width = 100;
答案 0 :(得分:-1)
正常windows controls there is property called Dock which u can set
ctrl.Dock = DockStyle.Buttom
在这种情况下,你需要https://msdn.microsoft.com/en-us/library/microsoft.office.tools.customtaskpane.dockposition.aspx我想
myCustomTaskPane.DockPosition =
Office.MsoCTPDockPosition.msoCTPDockPositionFloating;
myCustomTaskPane.DockPosition.DockPositionRestrict = msoCTPDockPositionRestrictNoChange;
https://msdn.microsoft.com/en-us/library/aa942864.aspx
由于需要创建Office应用程序,因此很难测试。