When I drag and drop a ToolTip
object on my form in C#, every control on the form gets a new property called ToolTip
which didn't exist before. I'm trying to create something just like ToolTip
so that when I drag and drop it onto my form all of the controls will automatically get its new property.
I would also be grateful if anyone could give me a definition for this so that I can edit my question to convey my intention and meaning better.
What you are looking for is an "Extender Provider". Very simply, you don't actually add the new property to the controls' grids. You instead implement an interface that the VS designer looks for, that tells VS how to "transform" the property set in the grid to a call to the Extender Provider to really do the trick.
In addition to ToolTips, LayoutPanels like TableLayoutPanel and FlowLayoutPanel do similar things, as well as certain other "meta-window components".
ToolTip
is an Extender Provider. The full documentation for implementing it is here, with a full example here.
ToolTip would likely be implemented like this:
[ProvideProperty("ToolTip", typeof(IComponent))]
class ToolTip : IExtenderProvider {...}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With