C# – Customizing the behavior of ControlDesigners for Controls derived from native .NET controls

cwindows-forms-designerwinforms

My question is related to this question:
Baseline snaplines in custom Winforms controls

However, in my case, I have created a new control that derives from TextBox rather than containing a TextBox. I would like to have a custom ControlDesigner, but I would like to modify the behavior of the TextBox's designer rather than having to write a complete designer myself. In particular, I'd like to be able to return the TextBox's SnapLines while providing some custom verbs. Is there a good way to do this?

EDIT: To clarify, this is for Windows Forms in .NET 2.0.

Best Answer

In the end, the solution I settled on was to create a dummy control in the designer, sync the relevant properties with the real control, get the designer for the dummy control, and then return the snaplines from the dummy control's designer. It's a terrible hack, but it seems to be the only way without using reflection to "extend" a designer.