I have problem with height of custom task pane in Excel. This task pane is created from Excel AddIn which is created using Excel-Dna library.
When docked to the left side with MsoCTPDockPosition.msoCTPDockPositionLeft
it does not take the full height but there is an empty space. This happens when an area with internal information is displayed on top of the worksheet window.
I saw when I resize manually the custom task pane window, the custom task pane height changes so it fills the whole space and the extra free space disappears.
Q: Is it possible to programmatically force the custom task pane to repaint/refresh so it takes the full height?
Q: Is it somehow possible to set up the custom task pane or the user control which it contains so it takes the full height when docked to the left?
Properties of the user control which is inside of the custom task pane has default values, nothing special.
In the code the Dock
of the user control is set to DockStyle.Fill
.
CodePudding user response:
It is out of your control. The CustomTaskPane.Width property can only be set if the DockPosition
property is Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight
or Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionLeft
.
To refresh the view (invalidate the UI) you are free to use Windows API functions as well as setting the Width
property. If you try to set the Height
property you may end up with a COMException
.