This documentation is archived and is not being maintained.

CustomTaskPane.Height Property

Gets or sets the height of the custom task pane, in points.

Namespace: Microsoft.Office.Tools
Assembly: Microsoft.Office.Tools.Common2007 (in

public int Height { get; set; }

Property Value

The height of the custom task pane, in points.

Exception typeCondition


The value of the DockPosition property is Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionTop or Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionBottom when you try to set the Height property.


The Dispose method of the CustomTaskPane has already been called.

Do not use the Height property if the custom task pane is docked to the left or the right of the document window. If the DockPosition property is Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight or Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionLeft, the Height property returns 0 and throws a ComException if you try to set it.

The following code example creates a custom task pane that has a specified height. This code example is part of a larger example provided for the CustomTaskPane class.

private MyUserControl myUserControl1;
private Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
    myUserControl1 = new MyUserControl();
    myCustomTaskPane = this.CustomTaskPanes.Add(myUserControl1, 
        "New Task Pane");

    myCustomTaskPane.DockPosition =
    myCustomTaskPane.Height = 500;
    myCustomTaskPane.Width = 500;
    myCustomTaskPane.DockPositionRestrict =
    myCustomTaskPane.Visible = true;

    myCustomTaskPane.VisibleChanged += 
        new EventHandler(myCustomTaskPane_VisibleChanged);
    myCustomTaskPane.DockPositionChanged += 
        new EventHandler(myCustomTaskPane_DockPositionChanged);