Reliable/easy way to replace Windows.Forms control with a derived control?
I didn't follow my own best practices (use only derived controls), and I dragged a regular Windows Forms contro开发者_Go百科l to my form, wired it up and used it on my form ;-(
Now I need to change the control to a derived control (derived from the same control), preserving all the settings from the designer. Is there a reliable/easy way to do this? (my current method is to remove the control, replace with the new control and ensure using differences to previous code that there are no changes other than in the class/namespace/assembly).
In Windows Forms, it's easy enough to just fix the declaration and construction in the .designer file. Just change the declaration line and construction line to use your Control class instead of System.Windows.Forms.XXX.
Once you change those two lines, it should "just work" as if you used your derived control.
精彩评论