I need to add some code to the EndInit method of a PictureBox control, but unfortunately it’s private and, from what I can gather, I can’t shadow it and call base – at least not in VB.NET.
What I can do is to add a dummy property to my picture box class. The type of the dummy property is simply a class that just implements ISupportInitialize. However, that doesn’t work, I need the dummy class to inherit from Control.
Is that the minimum requirement?
As you suspected, you need to make a proeprty that holds a dummy class implementing
ISupportInitialize.Then, expose the property like this:
Specifying
DesignerSerializationVisibility.Contentwill cause the designer to set the proeprties of the object instead of the object itself, and will also cause it to callBeginInit/EndInit.Obviously, you should instantiate the class in your constructor.