0

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.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
Willy
  • 9,848
  • 22
  • 141
  • 284

1 Answers1

1

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 SetFocus to 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.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Thanks again. Yep, that would be a possible workaround but I want to avoid using hacks or Windows API functions or third-party tools. The problem of sending 'ESC' keys using SendKeys.Send from the compose window, is that in compose window the 'ESC' key is a predefined key that closes the compose window. It is working fine on explorer window but not in the inspector (compose window). – Willy Nov 01 '22 at 18:24
  • 1
    I understood it from your post, but there is no trivial solution for that. Try playing with Windows API functions instead. – Eugene Astafiev Nov 01 '22 at 18:26
  • You say: "The SendKeys.Send method is the most easiest way of canceling the default action of resizing the pane". I have noticed that it is possible by sending one of the following keystrokes: {ESC}, {ENTER} and also by provoking a mouse click. Is there more keystrokes to cancel the resizing action using SendKeys.Send? – Willy Nov 04 '22 at 10:10
  • Sounds like a subject for a separate post there. Don't forget to mark the asnwers. – Eugene Astafiev Nov 04 '22 at 10:39