我创建了 VSTO Outlook 插件项目。添加了用户控件和其他控件。我可以通过单击功能区中的按钮来显示/隐藏自定义任务窗格。我想最小化和扩展它,就像右侧的文件夹窗格中内置的 Outlook 一样。我无法像文件夹窗格那样最小化或折叠它。
我添加了代码来更改任务窗格的宽度,但是有两个按钮“任务窗格选项”和“关闭 X”并没有让它看起来与最小化的文件夹窗格相同。
public CustomTaskPane custTaskPane;
public bool isTaskPaneCollapse = false;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
TaskPane tpControl = new TaskPane();
tpControl.BackColor = Color.White;
custTaskPane = this.CustomTaskPanes.Add(tpControl, " ");
custTaskPane.Visible = true;
custTaskPane.Width = 370;
custTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Globals.ThisAddIn.isTaskPaneCollapse = true;
Globals.ThisAddIn.custTaskPane.Width = 20;
}```
What is the right way of doing it? how to implement minimize and expand functionality for custom task pane