覆盖父控件的启用情况
在 WinForms 中,当您设置父控件的 Enabled
属性时,所有子控件都会效仿。
但是,我想始终启用单个子控件(无论父状态如何)。
在我的示例中,我在表格布局面板中有一堆控件,其启用状态绑定到复选框(恰好是子控件)的选中状态。
这可能吗?
我宁愿不向所有同级控件添加绑定。
也许周围有一个非可视的辅助分组容器“控件”/组件支持绑定?
In WinForms when you set the parent control's Enabled
property all of the child controls follow suit.
However, I would like to enable just a single child control to be always always enabled (regardless of parent state).
In my example, I have a bunch of controls in a table layout panel whose enabledness is bound to the check state of a checkbox (which happens to be a child control).
Is this possible?
I would rather not add bindings to all the sibling controls.
Perhaps there is a non-visual, secondary grouping container "control" / component around that supports binding?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你想做的事情是不可能的。 Windows 不会让你这样做。
重新考虑您的布局,将您现在用作父级的控件和您需要启用的子控件放置在超级父级的同一级别上(抱歉这个术语)。
What you want to do is impossible. Windows won't let you do it.
Rethink your layout, place the control you use now as a parent and that child control you need enabled on the same level in the super-parent (sorry for the term).