I have a custom task pane placed at the top and I don't want user to resize its height, I want to keep the height always the same. Also when user tries to resize it, I would like to show a messagebox saying he/she is not permitted to do so (without hacks please). How can I achieve this?
Maybe doing something similar to this? The problem with this approach is that SendKeys.Send("{ESC}"); is closing window when you are in composing window.
The SendKeys.Send method is the most easiest way of canceling the default action of resizing the pane. Instead, you may try to use Windows API functions such as
SetFocusto shift the focus from resizing the pane. But there is no a ready-made solution for that out of the box.As a possible workaround you may consider using Advanced Outlook Form Regions instead. They allow managing the form in the way you need - hide/show, collapse, change the size and layout at runtime and etc.