Reputation: 2579
I'm writing an outlook add-in and I'm looking for a way to make a panel docked on the right of my screen collapsible. At the moment the panel is either displayed or removed. You can also scale it but that's not what I'm looking for. I already tried adding 2 buttons which change the width of my panel onclick but the result is that my panel can't get smaller than about 60px in width and the title is still there. Here is the code I use to add my pane:
Microsoft.Office.Tools.CustomTaskPane ctp;
private HistoryPane ctrl;
string title = "Task History";
ctrl = new HistoryPane(mailItem);
ctp = Globals.ThisAddIn.CustomTaskPanes.Add(ctrl, title);
ctp.Visible = true;
ctp.Width = 460;
ctp.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight;
Any help to either remove the title, make the panel thinner (about 25px), make it collapsible or all of them would be much appreciated.
Upvotes: 2
Views: 1289
Reputation: 21
here is solution below:
1 - Create a public method in your user control like below:
private Microsoft.Office.Tools.CustomTaskPane _ctp; public void SetControl(ref Microsoft.Office.Tools.CustomTaskPane ctp) { _ctp = ctp; }
2 - Add any button to Expend and Minimize in your User Control and put below codes on Minimize button on click event:
private void btnMinimize_Click(object sender, EventArgs e) { _ctp.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionTop; _ctp.Height = 50; }
3 - After your code above use bold line code below:
Microsoft.Office.Tools.CustomTaskPane ctp;
private HistoryPane ctrl;
string title = "Task History";
ctrl = new HistoryPane(mailItem);
ctp = Globals.ThisAddIn.CustomTaskPanes.Add(ctrl, title);
ctp.Visible = true;
ctp.Width = 460;
ctp.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight;
ctrl.SetControl(ref ctp);
Hope this will work.
Upvotes: 2