Customizing the Options menu for ToolWindow

Docking/MDI for Windows Forms Forum

Posted 11 years ago by Miriam Kuruvilla
Version: 2.0.0099
Avatar

Is there a way to add custom options to the ToolWindow options menu?
For example in addition to {Floating|Dockable|AutoHide|Hide} I would like to add options like Rename and Close. How can I do this?

Comments (4)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Miriam,

Yes, you can process the DockManager.WindowContextMenu event and the default menu is in e.DefaultContextMenu. Other properties tell you why the menu was created. You can fully customize it before it was displayed.


Actipro Software Support

Posted 11 years ago by Miriam Kuruvilla
Avatar
I used the WindowContextMenu event to add a MenuItem to the DefaultContextMenu. It successfully added the new item, but when it is displayed, it looks completely different from the default menus. What do I need to do to create a custom menu item that looks like the default one?

This is the only line of code that i have so far.

e.DefaultContextMenu.MenuItems.Add("Rename", mnuRename_Click);
Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
You can use our OwnerDrawMenuItem class and add an instance of that to the menu. That is a regular MenuItem but renders like the others.


Actipro Software Support

Posted 11 years ago by Miriam Kuruvilla
Avatar
Perfect! Thanks a lot!
The latest build of this product (v2020.1 build 0400) was released 9 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.