WinForms:将操作绑定在一起
我记得当我以前做 C++ Builder 应用程序时,您可以创建一个操作,然后将菜单项或上下文菜单项等关联到该操作。 这样,如果您禁用诸如禁用操作之类的操作,则关联的菜单项将全部被禁用。 .net 2 winforms 应用程序中有类似的东西吗?
I remember back when I used to do C++ Builder apps, you could create an action, then associate a menu item or context menu item, etc to the action. That way if you dis something like disable the action , the associated menu items would all be disabled. Is there something like that in a .net 2 winforms app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你指的是命令模式。 .NET 2.0 中确实没有针对 Windows 窗体的开箱即用的东西。
在 Google 中搜索“命令模式 Windows 窗体”会出现一些博客条目,这些条目指出了您如何自己实现它,但我没有看到任何库形式的内容或有助于实现此目的的内容。
如果您使用的是 .NET 3.0,则可以切换到 WPF,它内置了命令模式功能。
What you are referring to is the command pattern. There really isn't something out of the box in .NET 2.0 for Windows Forms.
Doing a Google search for "command pattern windows forms" brings up a few blog entries which point out how you might implement it yourself, but I don't see anything in the form of a library or something to facilitate this.
If you are using .NET 3.0, you can switch to WPF, which has command pattern functionality built in.