Reputation: 10660
I have created and Outlook Add-in and I have created below Outlook custom task pane:
this.myUserControl = new myUserControl();
this.myCustomTaskPane = Globals.ThisAddIn.CustomTaskPanes.Add(this.myUserControl, Properties.Resources.myText, this.Window);
this.myCustomTaskPane.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionTop;
this.myCustomTaskPane.DockPositionRestrict = Microsoft.Office.Core.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange;
this.myCustomTaskPane.Height = 80;
this.myCustomTaskPane.Visible = false;
As you can see by default is not visible. Later under some conditions I make it visible:
this.myCustomTaskPane .Visible = true;
but the task pane is being shown collapsed. How can I make it expanded by default with the height I set?
I need to manually choose "resize" option from the custom task pane menu and I do not want this. I want it to be expanded with the custom height (80) by default. How can I do this programmatically?
Upvotes: 0
Views: 611
Reputation: 49453
Custom task panes don't provide the collapsed/expanded states unlike Outlook form regions.
The minimum height depends on several factors, and can change in future releases of Microsoft Office. If you try to set the Height
property to a value that is less than the minimum height, the application will automatically reassign the Height
property to the minimum height.
So, you just need to increase the size of the task pane to get it displayed expanded. Check out my post on the similar thread - How to Minimize/Collapse outlook-addin custom task pane as same as Folder Pane?.
Read more about dealing with custom task panes in Outlook in the Walkthrough: Display custom task panes with email messages in Outlook article.
Upvotes: 1