outlookvstooutlook-addinoffice-addinscustomtaskpane

VSTO Outlook: Detect when custom task pane is being resized manually


I have and VSTO Outlook Add-in which has a custom task pane at the top. Now I am trying to detect if there is a way or some trick to detect when the custom task pane is being resized (its height). Height resize can be done through the menu or clicking on the custom task pane splitter. So how can I detect that the user is being resizing the custom task pane height? is there some way?


Solution

  • You can override the OnResize method in any user control, for example, the following code can be used for the Outlook form region instance or custom task pane:

    protected override void OnResize(EventArgs e)
    {
       // add your code here
       base.OnResize(e);
    }
    

    Or just handle the Resize event of the UserControl class:

    private void UserControl1_Resize(object sender, EventArgs e)
    {
      // add your code here
    }