开发者

.Net sync menu item with toolbar button

开发者 https://www.devze.com 2022-12-20 18:45 出处:网络
I\'m creating a .Net3.5 Application (c#) and I want to write a generic code that synchronizes certain properties between toolbar buttons and menu Items that have the same purpose. For example setting

I'm creating a .Net3.5 Application (c#) and I want to write a generic code that synchronizes certain properties between toolbar buttons and menu Items that have the same purpose. For example setting a button 开发者_运维百科as disabled should set the respective menu item as disabled. My idea is to hold in a dictionary the lists of "paired" controls. Any ideas?


There is a CodeProject article here that explains how to use the manager for the Edit Controls and how the menu gets synchronized. I know the code has not being updated in a while as it uses the .NET 2003 framework, but I am sure it can be recompiled cleanly to coer the .NET 2 Framework.

The real beauty of this code is that if you have edit controls, the 'Edit' menu automatically synchronizes based on the edit control, i.e. if it can be 'Cut', 'Copy' or 'Paste' and it will deactivate/activate the menu item for that 'Edit' menu.

Hope this helps, Best regards, Tom.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号