none
Custom Task Pane - Outlook 2010 - VSTO - Visual Studio 2010 RRS feed

  • Question

  • In the addin developed for Outlook 2010, there is a Custom Task Pane which is activated on addIn loaded.

    The task pane appears on the right of the explorer. I have set the height and the width of the task pane. But the problem is that the task pane gets another size on load. When i change the size then it remains the same. So i cant see some of the controls on the Usercontrol.

    Monday, January 27, 2014 9:00 AM

Answers

  • Hello Erkan,

    What code did you use for setting the height and width of the task pane?

    For example, the following code illustrates the way of setting the Width and Height properties of 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 =
            Office.MsoCTPDockPosition.msoCTPDockPositionFloating;
        myCustomTaskPane.Height = 500;
        myCustomTaskPane.Width = 500;
    
        myCustomTaskPane.DockPosition =
            Office.MsoCTPDockPosition.msoCTPDockPositionRight;
        myCustomTaskPane.Width = 300;
    
        myCustomTaskPane.Visible = true;
        myCustomTaskPane.DockPositionChanged +=
            new EventHandler(myCustomTaskPane_DockPositionChanged);
    }
    

    What values do you try to assign to properties? Be aware, there are limitations that Custom Task Panes introduce to the code:

    When the custom task pane is docked to the left or right of the document window, the maximum width is approximately half the width of the screen. The minimum width depends on several factors, and can change in future releases of Microsoft Office. If you try to set the Width property to a value that is less than the minimum width, the application will automatically reassign the Width property to the minimum width. 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.

    Note, also you can use Outlook Form Regions.

     
    Monday, January 27, 2014 9:20 AM