工具提示控件如何使用新属性增强窗体上的所有控件?

时间:2021-07-31 14:56:04

When answering another question I started to wonder how I could Add new properties to all controls in a form just like the ToolTip-control does.

在回答另一个问题时,我开始想知道如何将新属性添加到表单中的所有控件,就像ToolTip-control一样。

For example I could use that to Add a "IsDirty"-flag to all textboxes just by adding the component to the form and it would handle this for every textbox.

例如,我可以使用它向所有文本框添加“IsDirty” - 标志,只需将组件添加到表单中,它就可以为每个文本框处理此问题。

When adding the tooltip-control to the form all controls magically gets a new property "Tooltip on tooltip1" that can be set both programatically and in design view.

将工具提示控件添加到表单时,所有控件都会神奇地获得一个新属性“Tooltip on tooltip1”,可以以编程方式和设计视图进行设置。

I want to be able to do my own enhancer like that.

我希望能够像这样做我自己的增强器。

1 个解决方案

#1


5  

It's an Extender Provider.

这是一个扩展提供商。

#1


5  

It's an Extender Provider.

这是一个扩展提供商。