Reputation: 10638
I have a custom task pane which I am trying to set its height programmatically. I have put a breakpoint just at the point where I change its height. From Visual Studio and in debug mode I have observed that after I press F10 key to process the assignment for the custom task pane height, then height is not set to the value I am trying to assign (for example 140), instead its height is changed to a value (80) which I don't know from where it is taken this value.
Why I observe such behavior and it is ignoring the height I am trying to set?
My custom task pane is initialized as below:
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 = 120;
this.myCustomTaskPane.Visible = false;
Later when I want to change its height to another value I perform below action:
this.myCustomTaskPane.Height = 140;
How can I set the height of the custom task pane to be the usercontrol height?
Upvotes: 0
Views: 127
Reputation: 49397
instead its height is changed to a value (80) which I don't know from where it is taken this value.
This is a min size of the task pane. You can't set lower values. That is by design.
Upvotes: 1
Reputation: 10638
It was happening because by default custom task pane has a default minimum height that depends on many factors. In my case was 80 so every time I was changing it to a a smaller value, then Outlook was automatically reasigning the height to the default one (80). Asigning a value greater or equal to 80 was working perfectly.
Upvotes: 0